0

I have following table structure

table domains

 ID     | name        |
________________________
   1    | example.com |
________________________
   2    | example.net |
________________________
   3    | example.org |

table products

 ID     | group        |
________________________
   1    | furniture    |
________________________
   2    | electronics  |
________________________
   3    | toys         |

table transit

 Domain.ID     |Produkt.ID |
_____________________________
   1           |    3      |
_____________________________
   1           |    2      |
_____________________________
   3           |    1      | 

as variable I have the domain name and in function of this I would like to get all the related products to the domain.

example:domain =>example.com should give me back the properties of product table with ID's 2 and 3

BenMorel
  • 34,448
  • 50
  • 182
  • 322
lgt
  • 1,024
  • 3
  • 18
  • 33

1 Answers1

3
Select domains.ID, name,group
from Transit Inner Join Domains ON
Transit.domainId = Domains.Id
INNER JOIN products  ON
Transit.productId = products.Id
Where domains.Name= ?
Romil Kumar Jain
  • 20,239
  • 9
  • 63
  • 92