Jump to content

id of one table pulling the id of another...


marco839

Recommended Posts

Im really confused, can someone point me in the right direction?

 

I have a login script which is seperate from another table which has details. (dont ask why, it makes it easier!)

 

So when id 1 logs into the normal system, i want the script to pull details from another table in a different database with the same id.

 

e.g.:

 

Table 1 (users)

Id | name

1  | mark

2  | jenny

 

Table 2 (details)

Id | detail

1 | Male

2 | female

 

So when Jenny logs in, the script identifies ID2 from table 1 and displays info from line 2 (id) in table 2

 

if that makes sense!!  Thanks,

Actually, this would be better because if the table2 doesn't have an entry you get no output, this way you always at least get the table 1 data

 

select table1.name,table2.detail

from table1

left join

table2

on table1.Id=table2.Id

where table1.name = 'jenny'

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.