This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL Help Please

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a hard time figuring out a query for the following:

I have 2 tables.

employee_table
---------
id
firstname
lastname
email

user_table
--------
id
password
role

Ok, A user is an Employee. So I didn't want to duplicate all the info in both tables. So what I need is a query that will get the row in the employee_table and the row in the user_table based on the ID and PASSWORD.

I suck at writing queries so any help would be appreciated. Thanks.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I think I got it.

select u.*, e.* from user_table as u join employee_table as e on u.USER_ID = e.EMP_ID WHERE u.password = 'password' and u.USER_ID = 'id'
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic