Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql two joins

SELECT areas.name AS aname, COUNT(consultants.active) AS cct 
    FROM areas 
    LEFT JOIN consAreas 
      ON consAreas.area = areas.id 
    LEFT JOIN consultants 
      ON consultants.id = consAreas.cons
   WHERE areas.areaID = $area 
     AND consultants.active = 1
GROUP BY areas.name
ORDER BY areas.name
Comment

PREVIOUS NEXT
Code Example
Sql :: r write csv without index 
Sql :: Sequelize model datatype of enum 
Sql :: sql select whole row max column 
Sql :: return the number of records in a single table mysql 
Sql :: how to convert external table to managed table in hive 
Sql :: how to open mysql in docker 
Sql :: square in sql 
Sql :: ImportError: DLL load failed while importing _sqlite3: The specified module could not be found. 
Sql :: mysqli auto increment id 
Sql :: inner join mysql 
Sql :: copy table in sql 
Sql :: oracle drop type if exists 
Sql :: how to update sql server version 
Sql :: mssql remove duplicate rows 
Sql :: while in sql server 
Sql :: mysql trigger 
Sql :: mysql error 1114 (hy000) the table is full 
Sql :: sql update multiple tables 
Sql :: add sqlite3 in lumen 
Sql :: hidden error sql codeigniter 3 
Sql :: ALTER TABLE CHANGE TABE SPACE ORACLE 
Sql :: SQL Server modify_timestamp trigger 
Sql :: many to many flask-sqlalchemy 
Sql :: mssql now diff 90 day 
Sql :: create directory in sql server 
Sql :: mysql varchar length 
Sql :: generate random data in mysql 
Sql :: local sql server 
Sql :: change column in mysql 
Sql :: find in set in postgresql 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =