I have a db model similar to this: Foreign key for multiple tables.
I have account table. An account may be of type venue or band. I decided to make a composite key in account table: id_account | type - together they'd make up a PK (type may be venue or band or their numeric equivalents)
I know how I'd e.g. select all venues with data from account table as well: SELECT account.*, venue.* FROM venue INNER JOIN account ON (venue.id=account.id AND type=venue).
Now, I have an administration panel in which user has his account (which is one of those type - venue or band). When he logs, the panel is different for venue accounts and for bands accounts. Do I need one query to check the type of account (let's say it's venue) and then another query to the venue table to grab his data? Otherwise - can I do something similar to:
SELECT ... FROM IF(type=venue, venue, band)