操作数应该在SELECT INNER JOIN上计算1列

时间:2017-04-06 15:07:23

标签: mysql sql

我试图在成就系统上运行SELECT查询我为游戏创建。

数据库有一个" timer_achievement"表,它只是具有激活值的静态成就。

它还有一个" timer_player_achievement"表格,其中包含有关每位球员和成就的成就进度的信息。

我尝试运行查询以获得符合条件的所有成就,它应返回3列; id,name和points,但是,它不会让我获得多个并回复错误

public class CustomDestinationDataProvider { static class MyDestinationDataProvider implements DestinationDataProvider { private DestinationDataEventListener eL; private HashMap<String, Properties> secureDBStorage = new HashMap<String, Properties>(); public Properties getDestinationProperties(String destinationName) { try { //read the destination from DB Properties p = secureDBStorage.get(destinationName); if(p!=null) { //check if all is correct, for example if(p.isEmpty()) throw new DataProviderException(DataProviderException.Reason.INVALID_CONFIGURATION, "destination configuration is incorrect", null); return p; } return null; } catch(RuntimeException re) { throw new DataProviderException(DataProviderException.Reason.INTERNAL_ERROR, re); } } public void setDestinationDataEventListener(DestinationDataEventListener eventListener) { this.eL = eventListener; } public boolean supportsEvents() { return true; } //implementation that saves the properties in a very secure way void changeProperties(String destName, Properties properties) { synchronized(secureDBStorage) { if(properties==null) { if(secureDBStorage.remove(destName)!=null) eL.deleted(destName); } else { secureDBStorage.put(destName, properties); eL.updated(destName); // create or updated } } } } // end of MyDestinationDataProvider //business logic void executeCalls(String destName) { JCoDestination dest; try { dest = JCoDestinationManager.getDestination(destName); dest.ping(); System.out.println("Destination " + destName + " works"); step4WorkWithTable(dest); } catch(JCoException e) { e.printStackTrace(); System.out.println("Execution on destination " + destName+ " failed"); } } static Properties getDestinationPropertiesFromUI() { //adapt parameters in order to configure a valid destination Properties connectProperties = new Properties(); // Add code here to set config settings return connectProperties; } public static void main(String[] args) { MyDestinationDataProvider myProvider = new MyDestinationDataProvider(); //register the provider with the JCo environment; //catch IllegalStateException if an instance is already registered try { com.sap.conn.jco.ext.Environment.registerDestinationDataProvider(myProvider); } catch(IllegalStateException providerAlreadyRegisteredException) { //somebody else registered its implementation, //stop the execution throw new Error(providerAlreadyRegisteredException); } String destName = "????"; CustomDestinationDataProvider test = new CustomDestinationDataProvider(); //set properties for the destination and ... myProvider.changeProperties(destName, getDestinationPropertiesFromUI()); //... work with it test.executeCalls(destName); } public static void step4WorkWithTable(JCoDestination dest) throws JCoException { JCoFunction function = dest.getRepository().getFunction("BAPI_COMPANYCODE_GETLIST"); if(function == null) throw new RuntimeException("BAPI_COMPANYCODE_GETLIST not found in SAP."); try { function.execute(dest); } catch(AbapException e) { System.out.println(e.toString()); return; } JCoStructure returnStructure = function.getExportParameterList().getStructure("RETURN"); if (! (returnStructure.getString("TYPE").equals("")||returnStructure.getString("TYPE").equals("S")) ) { throw new RuntimeException(returnStructure.getString("MESSAGE")); } JCoTable codes = function.getTableParameterList().getTable("COMPANYCODE_LIST"); for (int i = 0; i < codes.getNumRows(); i++) { codes.setRow(i); System.out.println(codes.getString("COMP_CODE") + '\t' + codes.getString("COMP_NAME")); } //move the table cursor to first row codes.firstRow(); for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) { function = dest.getRepository().getFunction("BAPI_COMPANYCODE_GETDETAIL"); if (function == null) throw new RuntimeException("BAPI_COMPANYCODE_GETDETAIL not found in SAP."); function.getImportParameterList().setValue("COMPANYCODEID", codes.getString("COMP_CODE")); //We do not need the addresses, so set the corresponding parameter to inactive. //Inactive parameters will be either not generated or at least converted. function.getExportParameterList().setActive("COMPANYCODE_ADDRESS",false); try { function.execute(dest); } catch (AbapException e) { System.out.println(e.toString()); return; } returnStructure = function.getExportParameterList().getStructure("RETURN"); if (! (returnStructure.getString("TYPE").equals("") || returnStructure.getString("TYPE").equals("S") || returnStructure.getString("TYPE").equals("W")) ) { throw new RuntimeException(returnStructure.getString("MESSAGE")); } JCoStructure detail = function.getExportParameterList().getStructure("COMPANYCODE_DETAIL"); System.out.println(detail.getString("COMP_CODE") + '\t' + detail.getString("COUNTRY") + '\t' + detail.getString("CITY")); }//for } }

我试图运行的查询如下:

Operand should countain 1 column(s)

这里有关于每张桌子的一些信息:

Achievement Table

Player Achievement Table

0 个答案:

没有答案