Hi, if I'm interpreting this correctly I don't think you need to nest your SELECT statements:

CruisesQuery.SQLQuery = "SELECT T2CruiseName, T2Forest, T2District, T2Tract, T2Compartment FROM Cruises WHERE UPPER(" + theField + ") LIKE (" + likeThis + ") AND T2OwnerID = '" + App.OwnerID

I don't think you're understanding the IN operator, I've just snatched this from the 'net:

The IN conditional operator is really a set membership test operator. That is, it is used to test whether or not a value (stated before the keyword IN) is "in" the list of values provided after the keyword IN.
For example:
SELECT employeeid, lastname,
FROM employee_info
WHERE lastname IN ('Hernandez', 'Jones', 'Roberts', 'Ruiz');

So, a nested SELECT after the 'IN (' must return a list of lastname's, OK?

Brian,

Here is my SQL statement

CruisesQuery.SQLQuery = "SELECT T2CruiseName, T2Forest, T2District, T2Tract, T2Compartment FROM Cruises WHERE UPPER(" + theField + ") LIKE (" + likeThis + ") IN (SELECT T2CruiseName, T2Forest, T2District, T2Tract, T2Compartment FROM Cruises WHERE T2OwnerID = '" + App.OwnerID + "')"

I've checked the file and there are records to be fetched. The above statement returns nothing. I've flipped that SELECTS around, and still nothing. I've been looking at this so long that I probably don't see some simple syntax error. If I delete the embedded SELECT statement, then it works, except that it fetches all owners, and not just the one I want. TJH


On Jan 31, 2006, at 8:58 AM, Brian Seavers wrote:

Do you mean:

SELECT INVOICE_NO, INVOICE_TOTAL FROM INVOICES WHERE INV_CUST_ID IN (SELECT CUST_ID FROM CUSTOMERS WHERE CUST_PCODE='nnn');

then, SQLite supports it.

I have a need to use a nested SQL statement, via the IN verb. SQLite cannot handle nested SQL statements, so does anyone know of a workaround for this problem?

Thanks,    TJH

--
Kind regards

Brian

"A moment's insight is sometimes worth a lifetime's experience"
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


--
Kind regards

Brian

"A moment's insight is sometimes worth a lifetime's experience"
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to