Click here to Skip to main content
14,878,672 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 3 Tables i.e.


CatID 01 02 03 04 05 06 07
CatName A B C D E F G


ProdID 01 02 03 04 05 06 07
ProdName P Q R S T U V

CatID 01 02 02 03 05 06
ProdID 01 02 03 04 04 04

Every Product can have multiple categories ..
So I want a merge table like 1st Category and then its products

ID Name
01 A --A Category
01 P -- All A Category Products
02 B --B Category
02 Q -- All B Category Products
03 R -- All B Category Products

Please let me know if you any other ideas
DiponRoy 11-Sep-14 13:19pm
if any category does have any product than what ?
pradiprenushe 11-Sep-14 22:16pm
Merger tables mean you want to create table or just want merge output?

1 solution

select a.CatName,c.ProdName from Categorys as a inner join [Cat-Prod] as b on a.CatID=b.CatID inner join Products as c on b.ProdID=c.ProdID


CatName ProdName
A          p
B          q
B          r
c          s
e          s
f          s

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