Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Select where in doesn't work with standard sql syntaxSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Sample Scripts Forum

 New Topic 
 
 Post Reply 
[1]  
 Select where in doesn't work with standard sql syntax 
 Author   Message 
  Keith Lester 
  
 Group: Members 
 Posts: 1 
 Joined: 2006-07-14 
 Profile
 Posted : 2006-07-14 01:46:58
We have been experiencing several issues with the performance of QODBC that require work arounds to try to accomplish something that should be standard sql syntax.  The performance on joins with three tables is so slow we have to do a two table join first and then append data.   Now we are experiencing an issue with getting 0 records returned for any query using the IN syntax with multiple values.   Below are examples of our results.

26 Records: SELECT A.CustomerRefListID, A.TxnNumber, A.TimeCreated, A.ARAccountRefListID, A.ClassRefFullName, A.TxnDate, A.CustomerRefListID, A.CustomerRefListID, A.TimeModified, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.TermsRefFullName, A.IsPending, A.TermsRefListID, A.TermsRefListID, A.TermsRefListID, A.TermsRefListID, A.ShipAddressPostalCode, A.ShipAddressCountry, A.IsPending, A.PONumber, A.TermsRefListID, A.TermsRefListID, A.TermsRefFullName, A.DueDate, A.SalesRepRefListID, A.SalesRepRefFullName, A.ShipMethodRefFullName, A.ItemSalesTaxRefListID, A.ShipDate, A.SalesTaxPercentage, A.SalesTaxPercentage, A.SalesTaxTotal, A.BalanceRemaining, A.IsPaid, A.CustomerMsgRefFullName, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, '' FROM INVOICE A, INVOICELINE B  WHERE A.TXNNUMBER=B.TXNNUMBER AND ({fn CONVERT(A.TimeCreated, SQL_DATE)} >= {fn CONVERT('2001-07-13',SQL_DATE)}) AND ({fn CONVERT(A.TimeCreated, SQL_DATE)} <= {fn CONVERT('2006-07-13',SQL_DATE)}) AND A.CUSTOMERREFFULLNAME = 'Abercrombie, Kristy:Remodel Bathroom'

 

24 Records SELECT A.CustomerRefListID, A.TxnNumber, A.TimeCreated, A.ARAccountRefListID, A.ClassRefFullName, A.TxnDate, A.CustomerRefListID, A.CustomerRefListID, A.TimeModified, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.TermsRefFullName, A.IsPending, A.TermsRefListID, A.TermsRefListID, A.TermsRefListID, A.TermsRefListID, A.ShipAddressPostalCode, A.ShipAddressCountry, A.IsPending, A.PONumber, A.TermsRefListID, A.TermsRefListID, A.TermsRefFullName, A.DueDate, A.SalesRepRefListID, A.SalesRepRefFullName, A.ShipMethodRefFullName, A.ItemSalesTaxRefListID, A.ShipDate, A.SalesTaxPercentage, A.SalesTaxPercentage, A.SalesTaxTotal, A.BalanceRemaining, A.IsPaid, A.CustomerMsgRefFullName, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, '' FROM INVOICE A, INVOICELINE B  WHERE A.TXNNUMBER=B.TXNNUMBER AND ({fn CONVERT(A.TimeCreated, SQL_DATE)} >= {fn CONVERT('2001-07-13',SQL_DATE)}) AND ({fn CONVERT(A.TimeCreated, SQL_DATE)} <= {fn CONVERT('2006-07-13',SQL_DATE)}) AND A.CUSTOMERREFFULLNAME = 'Baker, Chris:Family Room'

 

0 Records: SELECT A.CustomerRefListID, A.TxnNumber, A.TimeCreated, A.ARAccountRefListID, A.ClassRefFullName, A.TxnDate, A.CustomerRefListID, A.CustomerRefListID, A.TimeModified, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.TermsRefFullName, A.IsPending, A.TermsRefListID, A.TermsRefListID, A.TermsRefListID, A.TermsRefListID, A.ShipAddressPostalCode, A.ShipAddressCountry, A.IsPending, A.PONumber, A.TermsRefListID, A.TermsRefListID, A.TermsRefFullName, A.DueDate, A.SalesRepRefListID, A.SalesRepRefFullName, A.ShipMethodRefFullName, A.ItemSalesTaxRefListID, A.ShipDate, A.SalesTaxPercentage, A.SalesTaxPercentage, A.SalesTaxTotal, A.BalanceRemaining, A.IsPaid, A.CustomerMsgRefFullName, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, B.TxnID, '' FROM INVOICE A, INVOICELINE B  WHERE A.TXNNUMBER=B.TXNNUMBER AND ({fn CONVERT(A.TimeCreated, SQL_DATE)} >= {fn CONVERT('2001-07-13',SQL_DATE)}) AND ({fn CONVERT(A.TimeCreated, SQL_DATE)} <= {fn CONVERT('2006-07-13',SQL_DATE)}) AND A.CUSTOMERREFFULLNAME IN ('Baker, Chris:Family Room', 'Abercrombie, Kristy:Remodel Bathroom')

NOote that the above query should have returned 50 total records (24 + 26).

 
Below is a very simple example that doesn't work as it should.

108 Records: SELECT * From Customer Where IsActive IN (1)

0 Records: SELECT * From Customer Where IsActive IN (0,1)

The 2nd query should have returned 108 records too.


If the IN syntax doesn't work, then we have to run the query once for each customer name unless we use the OR with each customer name which will give unacceptably long response times .   This is standard sql syntax which we would expect to be supported.  Please respond to this request as soon as possible, because the syntax is required for the application to perform as it should. 

 
Keith 
 
  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-07-14 09:12:07

First the IN operand in QODBC really want's to do string compares (NOT TRUE/FALSE compares). This works without a problem:

SELECT * From Customer Where ListID IN ('970000-1071508343', '180000-933272658', '7D0000-1071526869')

For your ISACTIVE query:

SELECT * From Customer Where IsActive IN (0,1)

you can do:

SELECT * From Customer Where IsActive IN (0) or IsActive IN (1)

or just "SELECT * From Customer" instead.

As far three table joins are concerned you can link more than two tables in QODBC as long as it makes sense and you use the QODBC jump-ins (which act like indexes) to join the tables. For example:

SELECT InvoiceLine.CustomerRefFullName, InvoiceLine.TxnDate,
InvoiceLine.InvoiceLineDesc, InvoiceLine.InvoiceLineQuantity,
Customer.Balance, Customer.JobEndDate, Item.Type
FROM Customer Customer, InvoiceLine InvoiceLine, Item Item
WHERE InvoiceLine.CustomerRefListID = Customer.ListID
AND InvoiceLine.InvoiceLineItemRefListID = Item.ListID

You can find the jump-ins for any table by running:    sp_columns tablename

For example: sp_columns customer

If you update to QODBC v6.00.00.176 (or higher - see: How can I get the latest version of QODBC? ):

SELECT A.CustomerRefListID, A.TxnNumber, A.TimeCreated, A.ARAccountRefListID,
A.ClassRefFullName, A.TxnDate, A.CustomerRefListID, A.CustomerRefListID,
A.TimeModified, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate,
A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.DueDate, A.TermsRefFullName,
A.IsPending, A.TermsRefListID, A.TermsRefListID, A.TermsRefListID,
A.TermsRefListID, A.ShipAddressPostalCode, A.ShipAddressCountry,
A.IsPending, A.PONumber, A.TermsRefListID, A.TermsRefListID,
A.TermsRefFullName, A.DueDate, A.SalesRepRefListID, A.SalesRepRefFullName,
A.ShipMethodRefFullName, A.ItemSalesTaxRefListID, A.ShipDate,
A.SalesTaxPercentage, A.SalesTaxPercentage, A.SalesTaxTotal,
A.BalanceRemaining, A.IsPaid, A.CustomerMsgRefFullName, B.TxnID
FROM INVOICE A, INVOICELINE B  WHERE A.TXNNUMBER=B.TXNNUMBER AND
({fn CONVERT(A.TimeCreated, SQL_DATE)} >= {fn CONVERT('2001-07-13',SQL_DATE)})
AND ({fn CONVERT(A.TimeCreated, SQL_DATE)} <= {fn CONVERT('2006-07-13',SQL_DATE)})
AND A.CUSTOMERREFFULLNAME IN ('Baker, Chris:Family Room', 'Abercrombie, Kristy:Remodel Bathroom')

does return 50 records as expected:

 BTW: Instead of :

({fn CONVERT(A.TimeCreated, SQL_DATE)} <= {fn CONVERT('2006-07-13',SQL_DATE)})

You can do a simple Timestamp compare by doing:

(A.TimeCreated <= {ts '2006-07-13 00:00:00.000'})

 

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to