On 19/03/2009 3:09 AM, Patnaik, Anjela wrote:
> Hi John,
> 
> Thanks for your response!

Hi Anjela,

I'm presuming that your off-list reply was accidental.

> Now, the second column comes back as {} when I use sqlite TCL API. The TCL 
> llength is 1, instead of zero, probably due to the curly brace or something. 

Probability should have no effect. It would help if you showed what your 
  changed code actually looked like. Did you use coalesce(request2, '') 
or coalesce(request2, ' ')?

I suggest that you factor out TCL effects by first using the 
command-line sqlite3 program to see exactly what you have in there.

> 
> yeah, I probably should not use min.

Um? You should have already stopped using min, yes/no? *PLEASE* show 
what code you actually ran.

Consider that ' ' (one space character) is a very plausible result from 
a query like SELECT min(some_text_column) FROM ...

Try this to see what you have in request2:

SELECT rowid, typeof(request2), coalesce(request2, '***NULL***')
from MYTABLE
ORDER BY coalesce(request2, '')
LIMIT 10;

>  I just wanted to grab the first row.

First in what sense? Lowest rowid? Or do you really mean you just want 
one row, and don't care which one?

> I noticed rowid < 2 didn't work for me in the select. 

Either the row with rowid=1 has been deleted, or it failed to match your 
  WHERE clause.

Find out:
SELECT rowid, other_interesting_columns from mytable where rowid <= 5;

> How do I grab a specific row?

Either (a)
Just make up your mind what row you want and select it:
SELECT whatever from mytable WHERE your_specification_is_met;
or (b)
rephrase the question.

> Do you know if LIMIT 1 at the end is the same ?

The same as what? It depends on what order the output rows come in. You 
might consider using ORDER BY to make the order predictable. LIMIT 1 
will throw away all rows after the row that is first in the output order.

HTH,
John
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to