ms access - Complicated conditional SQL query -
I'm also not sure that this is possible, but I need it for my access database so I have db structure Has been followed:
Now I need to do a query that takes category_id from my product and makes magic:
- Say, the product console category_id
is in the table console)
- type_id
from console_types, where category_id == category_id
- but if Equi The product is related to console_game
( category_id
is in the table console_game
) - from console_game
LE game_cat_id
, where category_id == category_id
I'm not sure that mysql is capable of doing such a thing if I do not really have any problem, maybe it's 2,3 different - Is there a way to split into different questions?
Edit:
I have found something if existing (SELECT type_id FROM console WHERE category_id = 'category_id')
. Maybe it would be useful?
You will need to use a case statement to select this type:
Case status works in MySql, Sql server etc. (Syntax varies between implementation ).
Comments
Post a Comment