Complicated conditional SQL query
Posted
by DevAno1
on Stack Overflow
See other posts from Stack Overflow
or by DevAno1
Published on 2010-06-15T23:43:34Z
Indexed on
2010/06/15
23:52 UTC
Read the original article
Hit count: 261
I'm not even sure if it's possible but I need it for my Access database. So I have following db structure :
Now I need to perform a query that takes category_id from my product and do the magic :
- let's say product belongs to console (category_id is in table Console)
- from console_types take type_id, where category_id == category_id
- but if product belongs to console_game (category_id is in table console_game)
- from console_game take game_cat_id, where category_id == category_id
I'm not sure if mysql is capable of such thing. If not I'm really f&%ranked up. Maybe there is a way to split this into 2,3 separate queries ?
© Stack Overflow or respective owner