04-28-2011 08:04 AM
Solved! Go to Solution.
04-28-2011 09:32 AM
Do a google search for 'sql tutorial'. You need to learn how the SELECT statement works. The general syntax is:
SELECT column_name(s)
FROM table_name
WHERE column_name operator value
04-28-2011 09:38 AM
04-28-2011 09:59 AM
Retrieving all the records and then iterating through them is extremely inefficient. What if you have millions of records?
Just use this SQL statement:
SELECT Sess FROM yourtablename WHERE Subject = 'blahblahblah'
04-28-2011 10:21 AM
Also consider adding the LIMIT clause to set the max number of records to 1 (add LIMIT 1 to end of sql statement)
if the querry is not known to be unique. You can also sork prior to limit to get things like most recent or first or lest based on some other criteria.
04-28-2011 10:58 AM
@josborne wrote:
Retrieving all the records and then iterating through them is extremely inefficient. What if you have millions of records?
Just use this SQL statement:
SELECT Sess FROM yourtablename WHERE Subject = 'blahblahblah'
Not sure if this was directed at my comment, but... I didn't say retrieve all records, I said fetch the recordset data. The recordset contains the records that match the query (which, in my snippet, looks much like your SQL statement). You have another problem if your query can return millions of records but you only want one.