Page 1 of 1

select help needed

Posted: Wed Jan 28, 2004 7:39 am
by pelegk2
i have a table with user name,user password,full name
and another table with buy_id,user name
know when i print to the screen the row with the buy_id
i donnt want to print the user name but his full name (which is on the other table!
how do i do that?
thanks in advance
peleg

Posted: Wed Jan 28, 2004 7:46 am
by m3rajk
for future ref, this is a db q and belongs in that forum.

try: SELECT buy_id,full_name FROM buy_table INNER LEFT JOIN ON user_table WHERE buy_table.user_name=user_table.user_name ...


btw: i don't use many joins, so you might wanna double check on sybtax and all before using that.

Posted: Wed Jan 28, 2004 9:54 am
by McGruff
As mentioned, you need a table join. But first you could maybe improve your db design a little by adding auto-incrementing integer ids. It's good practice to have a "meaningless" id for every row ie don't use an invoice number, NI number etc which, as well as being a row identifier, has additional meaning.

All, including JOINs, explained here http://www.oreilly.com/catalog/javadtab ... r/ch02.pdf