Hello all,

I've tried a few SQL statements, but can't seem to get it to work
properly, so I'd like to ask your help.

Suppose I have a table like this:

CREATE TABLE test_table (ID INTEGER PRIMARY KEY, ExternalID, Data);

And some contents:

1| 2| -7
2| 2| 5
3| 1| 0
4| 2| -20
5| 2| -5
6| 2| 1
7| 1| 10

Now, what I'd like to do is get minimum (-20) and maximum (5) from the
table where ExternalID=2. It must be very simple, but I can't seem to
get the correct result. What I tried was:

SELECT min(Data) FROM (SELECT Data FROM test_table WHERE ExternalID=2);

But the above doesn't return the expected result.

Thanks for your help!

   Dennis


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

Reply via email to