Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone .. can you help me how to create a source having this logic wherein i need to compare a certain value in the first table in which the second data will insert the assigned string value on its column and can be change within the late status

1st table
id   |   name    |  status |  age  |
1    |   danny   |  single |  20   |
2    |  marlon   | married |  38   |
3    |   paul    |  single |  25   |


2nd table
id   |  name      |  educational level   |  status  |  
1    |  danny     |   undergraduate      |  single  |
2    | marlon     |  college graduate    |  married |
3    | paul       |    college graduate  |  married |


in which the final output will be
id  | name   | status |
1   | danny  | single |
2   | marlon | married|
3   | paul   | married|


i hope you understand this scenario.. thanks for advance for you help..
Posted
Updated 11-Jul-13 2:03am
v2
Comments
Sriram Bala 11-Jul-13 8:06am    
Hi, I am unable to understand your question. Are you looking for a SQL query to display the shown output?
Member 10033107 11-Jul-13 8:13am    
yes i will program in sql server as my database wherein i will use it to get the values and compare it??

1 solution

Try this:
SQL
SELECT t1.id, t1.[name], t2.status
FROM FirstTable AS t1 INNER JOIN SecondTable AS t2 ON t1.id = t2.id
 
Share this answer
 
Comments
Member 10033107 11-Jul-13 8:26am    
what if i use different columns name but same values?? there will be effect using this code?? btw thanks for you response :))
Maciej Los 11-Jul-13 8:28am    
I don't get you ;(
Please, be more specific and provide more details... example data.

You're welcome ;)
Member 10033107 11-Jul-13 8:33am    
for example i named 'status' as

in table 1 I use sta_tus and in table 2 is status..

there will be an effect using different column identifier? yet it has same value..? did you get me ?

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