Home > DeveloperSection > Forums > SQL foreign key between two tables
Lady Bird Johnson
Lady Bird Johnson

Total Post:20

Points:140
Posted on    July-08-2013 8:53 AM

 MSSQL Server MSSQL Server 
Ratings:


 1 Reply(s)
 776  View(s)
Rate this:
Hi Expert!

I was wondering if anyone could lead me through this SQL query.

I have two tables CS_JOBS and CS_JOBS_CATEGORY. They both have category_code row which I want to join.

PS: I will use these tables to populate the drop down box in php. 

Thank you!


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    July-08-2013 9:03 AM

Hi Lady!

Try as following

SELECT -- what you want to select
FROM CS_JOBS AS j
INNER JOIN CS_JOBS_CATEGORY AS c ON j.category_code = c.category_code;

I hope it helpful for you.

Don't want to miss updates? Please click the below button!

Follow MindStick