Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting one record with relation to two tables

Status
Not open for further replies.

ElTech

IS-IT--Management
Apr 16, 2003
22
US

How can I select one record with relation to two tables

for example

select * from system where user_id=admin_table id

and the result should be the name of the user whos id in the admin_table = the user_id in the users table
 
ElTech, I'm certain we can solve you need, but first, I need to understand better what you want: Your "SELECT * ..." suggests that you want all columns displayed from at least the table SYSTEM, yet the next line says, "...the result should be the NAME of the user whose id in the admin_table = the user_id in the users table."

Could you please clarify what you want for output. Also, could you please post a mini-DESCRIBE of the tables involved: specifically, the columns that you are matching between the tables and the columns you want displayed?

Thanks,

Dave
 


Thanks SantaMufasa.

I have one system table that contains the admin number.

Once in a while we need to delete all users, except the admin.

So the command will have to delete from users where userid <> system table admin_user_ID
 
this admin number, i gues it is coming from an admin_table. is it just one number or are there many ids?

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top