I have a mysql database with a list of companies who supply specific
products
tblSuppliers (simplified)
sID | sName | goodsRefs
1 | comp name | 1,2,3,4,5
2 | company 2 | 2,4
tblGoods (simplified)
gID | gName
1 | fish
2 | bread
3 | apples
4 | bananas
5 | chocolate
The idea is that the comma seperated list relates to the goods they supply
is it possible to show all suppliers who provide bread?
I know of the IN syntax but this only works using SELECT * from tblGoods
WHERE gID in (1,2)
How do i create a SELECT Statement to show the companies containing the ID
2 in their respective comma separted list
Any help would be gratefully appreciated
Craig
products
tblSuppliers (simplified)
sID | sName | goodsRefs
1 | comp name | 1,2,3,4,5
2 | company 2 | 2,4
tblGoods (simplified)
gID | gName
1 | fish
2 | bread
3 | apples
4 | bananas
5 | chocolate
The idea is that the comma seperated list relates to the goods they supply
is it possible to show all suppliers who provide bread?
I know of the IN syntax but this only works using SELECT * from tblGoods
WHERE gID in (1,2)
How do i create a SELECT Statement to show the companies containing the ID
2 in their respective comma separted list
Any help would be gratefully appreciated
Craig
Comment