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 |
|
iceice
Starting Member
5 Posts |
Posted - 2011-07-20 : 07:00:29
|
| i want to query two tables. some example fields and data below:call_req table (its main table)--------------idrefnumsummarydescriptionstatusact_log table (its second table)--------------call_req_idtype (example: RE,TR,LOG,INIT,CL,...)descriptioni want to query all rows in main table and if any id equal with call_req_id in second table (just 'RE' type) i want to see type description in RE type.can you help me, thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-07-20 : 07:20:04
|
its just a simple left join likeSELECT cr.*,al.descriptionFROM call_req crLEFT JOIN act_log alOn al.call_req_id = cr.idand al.type='RE' ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
iceice
Starting Member
5 Posts |
Posted - 2011-07-20 : 08:26:07
|
| I tried this query. Its working.Thank you. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-07-20 : 08:27:36
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|