I have a couple joins that I'm doing. I say tablename.column to identify what I want to select in the database...don't want to select all columns. However, my last join I do want to select all for that. Is there a way I can use an asterisk or something for the last join?
The last table is going to be dynamic too so I can't hard code it in (although I could write it out dynamically) but thought there might be an easier way.
SELECT content_name.name,
house.listing,
street.*
FROM content
INNER JOIN house ON content_name.id=house.id
LEFT JOIN street ON content_name.id=street.id;
Alias your last table the same way everytime, and then just .* your alias.
SELECT content_name.name,house.listing, last_table.*
FROM content INNER JOIN house ON
content_name.id=house.id
LEFT JOIN street last_table ON content_name.id=last_table.id;
That being said, * in a production query is an accident waiting to happen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With