Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have 3 table.

Table1
StreamID int,
Stream Varchar,

Table2
PostStreamID int,
Stream Varchar,

Table3
UserID int
StreamID varchar(10),
PostStreamID varchar(10),
userName char(10)

Table1
-------------------------------------------
StreamID Stream
1 MCA
2 M.Tech
3 B.Tech


Table 2
-------------------------------------------
PostStreamID Stream
1 MA
2 Msc
3 Bsc


Table3
--------------------------------------
UserID StreamID PostStreamID userName
1 '1','2' '1','3' Jhon
2 '2','3' '2','3' Sachin

Now i want to join all the 3 table and fetch Stream and user name.How Can i do this? Please Help me.
Posted
Comments
Sandeep Mewara 15-Jan-11 5:04am    
1. I would suggest another table design to store values
2. The comma separated values stored in 3 - why are they like '1','2' and not '1,2' ?
c27bharti 15-Jan-11 8:21am    
ya values are coming from my asp.net page where HR is posting job and he/she want a M.tech and MCA and also in +3 B.tech and BCA candidate. there for i have that option on my page to select multiple qulification and then post the job therefore i'm inserting id of selected value. and again i have show all the jobs and there i need to show what qulification need for which job there for i'm using join and try to show. It is my first project. What i should do. Help me. my english is not very good.

1 solution

The table structure is not normalized. You first need to normalize your tables as they dont even fall in 1st Normal form.

Then enter data correctly. Then only you will be able to set relationship between tables and fetch data easily with joins.

The table structure you have right now is messy and not at all fit for joining (un-relational) the way I see it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900