On 5/8/2012 9:58 PM, Shorty wrote:
I've got a database that users can request to join the mailing list.
After they add their name and email address, I'll assign them a userID
number.

The database looks like this:

recordID userID name email
1 1 John j...@somewhere.com
2 2 Mike m...@example.com
3 3 Bill b...@example.com
4 null Steve st...@example.com

this works:
SELECT max(userID) AS 'highest_userID' FROM maillist WHERE userID <> ''
then highest_userID is returned with a value of 3

Your database doesn't contain the data you think it does. Unassigned userId values are not NULL, but empty strings. By SQLite rules, any string is compared greater than any number.
--
Igor Tandetnik

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

Reply via email to