/*SELECT * FROM `buildings` bldg inner join organizations org on org.org_id = bldg.organizations_id WHERE bldg.organizations_id = 57; #bldg_id = 289 SELECT * FROM buildings WHERE bldg_id IN(549, 571); SELECT * FROM organizations WHERE org_id IN(0, 12);*/ #Select DISTINCT buildings_id FROM spc_users ORDER BY 1; select bldg_id from buildings where organizations_id = 57 ORDER BY 1; SELECT * FROM `buildings` WHERE bldg_id IN(183, 238, 239, 241, 242, 243, 318, 393, 397, 399, 400, 402, 507, 549, 550, 551, 552, 554, 555, 556, 571, 573, 577, 612, 1113); SELECT * FROM organizations WHERE org_id IN(4, 53, 61, 6, 87, 95, 9, 12, 13, 112);