Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mkh
Starting Member
18 Posts |
Posted - 2003-05-20 : 05:31:36
|
| I want to write a sql statement to display the following results from 2 tables FOR A particular NO:-------------------------------------------NO |CO-ID | CO-NAME | PROJ-ID | PROJ NAME | ------------------------------------------- 1 12 ABC 121 PRJ1OF11 12 ABC 122 PRJ1OF21 21 XYZ 221 PRJ2OF11 22 XYZ 222 PRJ20F2 my tables are:table company------------------------NO | CO-ID | CO-NAME |------------------------table project--------------------------------- NO | CO-ID | PROJ-ID | PROJ-NAME |---------------------------------SOLUTION should appear as shown:can any one give me the exact sql.Edited by - mkh on 05/20/2003 05:36:07 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2003-05-20 : 05:40:21
|
| SELECT [NO], [CO-ID] , [CO-NAME], [PROJ-ID], PROJ NAMEFROM companyINNER JOIN project on project.[no] = company.[no]and project.[co-id] = company.[co-id]WHERE [no] = 1ORDER BY [NO], [CO-ID], [CO-NAME]?[edit to say I'm not sure if you actually want all those dashes and things, that would really be a job for your presentation layer.]-------Moo.Edited by - mr_mist on 05/20/2003 05:42:24 |
 |
|
|
mkh
Starting Member
18 Posts |
Posted - 2003-05-20 : 06:01:19
|
| thks Mr Mist it works expect that you have to give 'table.colname at some places.yeah those dashes were meant just for clarity.thats all for now.bye |
 |
|
|
|
|
|