Simon / Mircea -- Great suggestions !! They aren't what I am after, but they are great ideas that I will use elsewhere and didn't know about those before.

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

SELECT max(userID) AS highest_userID FROM maillist WHERE (userID <> '') AND (userID IS NOT NULL)

The query suggested earlier by Simon (shown above) appears to be exactly what I am looking for, but it returns a NULL instead of the expected 3. If we can figure how to get the query to return the expected 3, it resolves all of the problems and doesn't matter if the field is a NULL or a blank string.


Thanks
Shorty



from Simon:
UPDATE maillist SET userID = NULL WHERE userID = ''
UPDATE maillist SET userID = '' WHERE userID IS NULL
Then you won't need both clauses in your SELECT command.


From Mircea
My preference would be for userID as INTEGER PRIMARY KEY AUTOINCREMENT and a separate column for validation (1=validated, 0 = not validated)

CREATE TABLE mailist (
 userID        INTEGER PRIMARY KEY AUTOINCREMENT,
 validated     INTEGER DEFAULT 0,
 name          TEXT,
 email         TEXT
);


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

Reply via email to