[thelist] SQL help
David Siedband
technique at oceanicsky.com
Fri Jan 21 03:56:18 CST 2005
On Jan 20, 2005, at 11:11 PM, Tim Burgan wrote:
> is this the correct SQL to seach if a username already exist across
> two tables, both containing id (unique number) and username (unique
> string) fields?
You want to find if this username occurs in both tables, with
'username' as the key?
> SELECT id
> FROM tblStaff, tbl Students
> WHERE username = '$username';
select id.tblStaff
from tblStaff, tblStudents
where tblStudents.username = '$username'
and tblStudents.username = tblStaff.username ;
> if the username does NOT exist the recordset will return EOF (End of
> File). Is this correct
Yeah, but you might find it more useful to describe the result in the
context where your application code is running.
e.g., variables not available in the namespace.
--
David
More information about the thelist
mailing list