I am looking into the following sql codes, trying to understand but confused:
What does the query actually do when we put the two tables together? What's the difference between this and joining the two tables? Thanks!
select * from
Logs, (select @count:=0,@record:=(SELECT num from Logs limit 0,1)) r
The Logs
table looks like this:
+----+-----+
| Id | Num |
+----+-----+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 2 |
| 5 | 1 |
| 6 | 2 |
| 7 | 2 |
+----+-----+
If you don't join the tables, they work like cross join
. Number of rows left side * number of rows right side.