Skip to content

Tag: mysql-5.6

SQL: difference between where in main body vs join clause

I’m wondering why does the following queries give me a slightly different dataset: So I just moved BETWEEN clause to the main body, logically, it does not matter where to apply it, but the result says it matters. Any suggestions? Thanks! UPD: tried on MySQL 5.6 Answer Maybe it’s hard to answer thi…

Complex mysql query counting

I have 1 table name “companies” with several datas like : Id Owner Company Job 1 John Doe Company 1 CEO 1 John Doe Company 2 CEO 1 John Doe Company 3 CEO 1 Gab Durand Company 4 CEO 1 Rob Dujn Company 5 CTO 1 Alex DoeMorse Company 6 COO What I need is to get 1 line by