x++ and sql query


plz let me know how to solve the following problem :

1.If there are two or more tables and sum on a particular field is required with proper grouping.

2.How to excute IN / Not IN in x++ ?

3.How to write subquery like SQL server 2008 in x++.

You could always try using a direct sql call via a sql connection if you are having trouble with queries in x++. Something like:

UserConnection userConnection;

Statement statement;

SqlStatementExecutePermission sqlPermission;

ResultSet resultSet;

str sql;



sql = strfmt(sql); // format the query

userConnection = new UserConnection(); // create connection object

statement = userConnection.createStatement(); // create statement

sqlPermission = new SqlStatementExecutePermission(sql); // create and assert SQL statement execute permission


resultSet = statement.executeQuery(sql); // assign return of query to resultSet

CodeAccessPermission::revertAssert(); // limit the scope of the assert call