Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there some way to select the first table without writing all the fields names in the query?

Q: If I have two tables joined together, and I want to get (*) from the first table, I mean all the fields of the first table.

Shall I write all the fields names of the first table in the query? Or is there some way to select * just from the first table.

like image 402
Anyname Donotcare Avatar asked Nov 27 '25 17:11

Anyname Donotcare


1 Answers

You should not to list all the fields, see the example:

SELECT DISTINCT t1.*
from T1
join t2 on condition
like image 103
Oleg Dok Avatar answered Nov 30 '25 10:11

Oleg Dok



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!