---
title: "SQL foreign key between two tables"  
description: "SQL foreign key between two tables"  
author: "Lady Bird Johnson"  
published: 2013-07-08  
updated: 2013-07-08  
canonical: https://www.mindstick.com/forum/1266/sql-foreign-key-between-two-tables  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# SQL foreign key between two tables

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances)!\
I was wondering if [anyone](https://www.mindstick.com/articles/23207/how-to-find-the-best-fit-job-for-anyone) could lead me through this [SQL query](https://www.mindstick.com/forum/529/rename-table-name-and-column-name-using-sql-query).\
I have [two tables](https://www.mindstick.com/forum/159646/how-to-join-two-tables-in-oracle-to-get-single-line-results) CS_JOBS and CS_JOBS_CATEGORY. They both have category_code [row](https://www.mindstick.com/forum/1212/this-row-already-belongs-to-this-table) which I want to join.\
PS: I will use these tables to [populate](https://www.mindstick.com/blog/60/populate-records-in-second-listbox-according-to-the-selection-in-first-list-box) the [drop down](https://www.mindstick.com/forum/263/drop-down-list-problem) box in php. \
Thank you!

## Replies

### Reply by AVADHESH PATEL

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.


---

Original Source: https://www.mindstick.com/forum/1266/sql-foreign-key-between-two-tables

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
