MySQL - is it legal to do 'SELECT table1.*,table2.column FROM table1,table2'? [closed]
MySQL - is it legal to do 'SELECT table1.*,table2.column FROM table1,table2'
?
It is legal, but it will give you a Cartesian product of the two tables. Are you sure that you want a Cartesian Product?
Most times, you would use a JOIN as in:
Select Table1.*, Table2,ColumnName
From Table1
INNER JOIN Table2
ON Table1.PKColumn = Table2.FKColumn
While this theta syntax is legal, it's just too easy to miss a join condition without the parser warning you.
精彩评论