Hi, I'm trying to make a SELECT
where I need to select a specified table by a column wich define the type of subject:
table_buildings
id name location source_type source_id
1 NY Appartament New York 0 NULL
2 Guggenheim Museum Manhattan 1 27
3 MoMA New York 2 3
table_url // source type == 1
id name url
27 Guggenheim Site http://www.guggenheim.org/
table_books // source type == 2
id name pages sample author
3 World Museums 125-127 path/img.jpg John Smith
I don't know if it's possible, but I have some problem to solve it without an IF
statement inside my query because I can find the right table by the source_type
column of table_buildings
does exist soma tecnique to use an IF
inside a SELECT
query?