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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select Query

Author  Topic 

asm
Posting Yak Master

140 Posts

Posted - 2014-09-14 : 09:46:46
Hi,

Till now I get data form multiple table using join, but unable to understand how can i get the this result based on given table -

Result should be -

ProCode Product Name
PRO00001;PRO00002 Product Test Searched Promotion One;Promotion Two
PRO00001;PRO00002;PRO00002 Product Final Searched Promotion One;Promotion Two;Promotion Three
PRO00002 Testing Promotion Two

Tables -
select * from ProMaster
Code Name
PRO00001 Promotion One
PRO00002 Promotion Two
PRO00003 Promotion Three

select * from ProDetail
ID ProCode Product
1 PRO00001;PRO00002 Product Test Searched
2 PRO00001;PRO00002;PRO00002 Product Final Searched
3 PRO00002 Testing

chikupalli
Starting Member

3 Posts

Posted - 2014-09-14 : 10:34:41
HI Try this,
select a.code,a.name b.procode,b.product from proMaster a
innerjoin proDetail b where a.code=b.procode
Go to Top of Page

asm
Posting Yak Master

140 Posts

Posted - 2014-09-14 : 10:50:13
This seems simple inner join query...
Go to Top of Page
   

- Advertisement -