Phil, Brian, Russ,
Thank you for your responses. Brian's solution worked. I was trying
to make this too difficult. The SQL statement that works is:
CruisesQuery.SQLQuery = "SELECT T2CruiseName, T2Forest, T2District,
T2Tract, T2Compartment FROM Cruises WHERE (UPPER(" + theField + ")
LIKE (" + likeThis + ")) AND T2OwnerID = '" + App.OwnerID + "'"
per Brian's suggestion. I just needed to add an end quote.
I will consider the NUG list server next time. Although I've been
programming computers since 1973, I only started in REALbasic last
summer. So I do consider myself a beginner.
Thanks again for everyone's help.
TJH
On Jan 31, 2006, at 10:57 AM, Russ Jones wrote:
If you are boggling the database engine, you could always do a work-
around by running one SELECT statement to choose the owner you are
interested in, then use that information to create another SQL
statement that gets the information you really want.
This type of work-around is easier to debug, and should work
reasonably efficiently as long as you order your searches so that
the initial select returns a small recordset.
Russ
On Jan 31, 2006, at 12:39 PM, TJ Hanson wrote:
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
_______________________________________________
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>