Join table 1 or join table 2 depending question...
So I have a generic parts table:
Fields: ID, NAME
And I have two tables of parts that could pulled from. The first table is all the parts with their relationship to the generic_parts table:
Fields: ID, NAME, PRICE, GENERIC_ID, IS_DEFAULT
So I join those two and with a WHERE statement I can get the default Part for a specific GENERIC_PART record.
The problem is that users have the ability to create their own parts that will override the PARTS tables default part for the Generic item. So:
Fields: ID, NAME, PRICE, GENERIC_ID, USER_ID
How do I, in one statement, check the USER_PARTS table for a part first before using the PARTS table for the GENERIC items part?
I could combine the PARTS AND USER_PARTS with the regular parts having no USER_ID value and the USER_PARTS having the USER_ID value if that helps.