Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.59 KB | None | 0 0
  1. SELECT SQL_CALC_FOUND_ROWS `crm_customers`.`id`, `global_id`, `source`, `company_name`, `group_id`, `crm_customers`.`name`, `surname`, `secondname`, `manager_id`, `customer_creator_id`, `email`, `phone`, `address`, `create_date`, `crm_customers`.`comment` AS `comment`, `publish`, `marktype`, `nattype`, `customer_heat`, `customer_activity_type`, `customer_activity_date` , ( SELECT `order_extproperty_values`.`value_select` FROM `extproperty_values` AS `order_extproperty_values` WHERE `order_extproperty_values`.`object_id` = `crm_customers`.`id` AND `order_extproperty_values`.`property_id` = 1946 LIMIT 1 ) AS `extorder` FROM `crm_customers` INNER JOIN `extproperty_values` ON `extproperty_values`.`object_id` = `crm_customers`.`id` LEFT JOIN `crm_shared_managers` ON `crm_customers`.`id` = `crm_shared_managers`.`share_id` AND ( `crm_shared_managers`.`share_type` = 'customer' OR `crm_shared_managers`.`share_type` IS NULL ) WHERE `publish` = 1 AND `marktype` IN('0','7','8','9','10') AND ( (`manager_id` IN('0','133','524','71','593','79','98','1313','595','740','1273','531','184','717','1106','1163','1036','1319','311','866','1197','1308','809','1094','730','1139','1318','1272','835','825','1309','74','833','981','222','1239','1321','616','1311','706','1154','889','807','1088','1315','1187','884','68','1052','844','1261','198','73','57','409','361','294','1213','414','1033','872','925','353','976','525','1243','1231','640','515','1322','986','627','1172','1143','1301','282','1058','1193','1207','1030','1305','973','1248','391','967','1279','726','1028','214','1260','1229','1294','791','456','926','445','1312','1232','1176','1267','1284','1285','943','682','842','965','333','103','369','1211','756','160','164','1108','397','467','1078','97','87','1190','590','543','1125','1100','769','1104','750','1053','737','780','1310','299','887','696','1274','1306','644','399','1253','144','330','257','1189','312','1170','774','204','776','1191','1289','810','1171','1096','326','523','1254','183','817','194','637','1300','1095','1174','431','1323','512','840','1079','477','453','912','1202','205','1295','1296','1012','651','1316','1240','648','1227','874','128','1290','526','332','1228','1251','604','1304','191','1000','354','895','877','830','1192','1314','911','622','942','1287','555','78','812','125','662','213','1302','1242','238','1277','793','264','961','249','289','905','155','1138','170','1066','179','131','1065','1105','158','1166','1144','69','335','444','663','1126','999','681','1153','1222','1120','632','187','1093','923','745','746','545','1186','114','1117','1278','946','1116','1140','1025','1230','650','1010','818','1183','690','1054','1102','962','1147','718','403','175','1194','107','1179','902','1185','118','960','338','1072','447','1149','1014','975','868','527','1001','292','1050','1159','271','1181','148','1114','1112','952','316','977','225','620','606','458','290','1074','288','789','417','145','1069','941','720','1241','130','402','1081','322','1263','1034','1009','305','972','1168','796','790','1146','303','908','537','1115','1182','1200','997','1111','689','920','635','1113','162','855','1015','1275','1004','1259','167','449','722','1038','1046','861','1127','914','85','665','931','711','1145','922','1041','959','508','1218','1286','376','647','1016','822','1212','1208','285','680','1292','186','237','1121','592','1252','1022','1164','1169','80','904','165','273','192','1037','998','1283','1026','1107','713','1206','864','1020','454','933','324','1177','857','1136','1209','476','1299','871','636','1195','921','1023','276','1223','1255','1256','109','247','1280','797','1152','1098','1013','738','1247','1249','1155','254','739','631','1056','1180','235','1262','1027','795','1017','1045','1219','1184','1221','169','934','671','1060','1307','733','272','242','1257','1237','906','111','1062','1244','1099','149','189','876','461','1142','1198','916','1265','826','230','1135','729','1087','945','588','1067','320','1225','865','61','212','1085','1103','996','815','221','1291','1175','1024','852','301','697','1236','1073','140','1110','1089','368','1080','124','151','1178','1156','1264','765','117','578','1217','1141','843','963','994','1250','794','1320','1210','928','913','1003','1203','1161','200','988','735','1293','552','234','90','394','1071','199','67','859','1051','1122','1101','749','1070','849','161','1157','265','510','853','262','612','483','1130','829','940','1235','837','229','1082','147','218','1134','1224','626','867','950','211','1165','495','386','694','441','245','1132','1288','1084','129','1162','340','275','898','1150','1042','307','1160','1055','1039','875','366','1151','954','1124','123','392','628','339','345','112','94','1005','1019','1158','1092','1076','255','284','1086','88','86','850','171','1266','182','881','799','248','1075','429','585','1131','1148','356','910','267','1297','1137','1063','1216','1049','207','460','181','102','63','1246','278','185','1214','1018','1123','104','193','1269','233','1021','1047','141','1008','206','1233','716','398','188','203','243','1068','108','1258','639','974','838','1245','209','1282','1083','152','1276','1002','105','157','1270','686','932','883','1011','1317','1234','599','266','251','536','1035','1061','732','1173','1298','1188','1201','1204','132','1057','172','1097','688','712','168','1271','957','302','598','435','154','281','1109','336','196','390','580','591','572','566','1043','823','1167','1129','1064','1040','845','178','1048','176','379','514','607','672','1119','919','116','873','115','100','1303','918','146','834','1238','1044','1220','459','1199','930','699','695','423','1077','228','1196','1059','600','1133','314','1090','1091','1128','1029','1118','1032','99','92')) OR (`crm_shared_managers`.`share_employee_id` IN('0','133','524','71','593','79','98','1313','595','740','1273','531','184','717','1106','1163','1036','1319','311','866','1197','1308','809','1094','730','1139','1318','1272','835','825','1309','74','833','981','222','1239','1321','616','1311','706','1154','889','807','1088','1315','1187','884','68','1052','844','1261','198','73','57','409','361','294','1213','414','1033','872','925','353','976','525','1243','1231','640','515','1322','986','627','1172','1143','1301','282','1058','1193','1207','1030','1305','973','1248','391','967','1279','726','1028','214','1260','1229','1294','791','456','926','445','1312','1232','1176','1267','1284','1285','943','682','842','965','333','103','369','1211','756','160','164','1108','397','467','1078','97','87','1190','590','543','1125','1100','769','1104','750','1053','737','780','1310','299','887','696','1274','1306','644','399','1253','144','330','257','1189','312','1170','774','204','776','1191','1289','810','1171','1096','326','523','1254','183','817','194','637','1300','1095','1174','431','1323','512','840','1079','477','453','912','1202','205','1295','1296','1012','651','1316','1240','648','1227','874','128','1290','526','332','1228','1251','604','1304','191','1000','354','895','877','830','1192','1314','911','622','942','1287','555','78','812','125','662','213','1302','1242','238','1277','793','264','961','249','289','905','155','1138','170','1066','179','131','1065','1105','158','1166','1144','69','335','444','663','1126','999','681','1153','1222','1120','632','187','1093','923','745','746','545','1186','114','1117','1278','946','1116','1140','1025','1230','650','1010','818','1183','690','1054','1102','962','1147','718','403','175','1194','107','1179','902','1185','118','960','338','1072','447','1149','1014','975','868','527','1001','292','1050','1159','271','1181','148','1114','1112','952','316','977','225','620','606','458','290','1074','288','789','417','145','1069','941','720','1241','130','402','1081','322','1263','1034','1009','305','972','1168','796','790','1146','303','908','537','1115','1182','1200','997','1111','689','920','635','1113','162','855','1015','1275','1004','1259','167','449','722','1038','1046','861','1127','914','85','665','931','711','1145','922','1041','959','508','1218','1286','376','647','1016','822','1212','1208','285','680','1292','186','237','1121','592','1252','1022','1164','1169','80','904','165','273','192','1037','998','1283','1026','1107','713','1206','864','1020','454','933','324','1177','857','1136','1209','476','1299','871','636','1195','921','1023','276','1223','1255','1256','109','247','1280','797','1152','1098','1013','738','1247','1249','1155','254','739','631','1056','1180','235','1262','1027','795','1017','1045','1219','1184','1221','169','934','671','1060','1307','733','272','242','1257','1237','906','111','1062','1244','1099','149','189','876','461','1142','1198','916','1265','826','230','1135','729','1087','945','588','1067','320','1225','865','61','212','1085','1103','996','815','221','1291','1175','1024','852','301','697','1236','1073','140','1110','1089','368','1080','124','151','1178','1156','1264','765','117','578','1217','1141','843','963','994','1250','794','1320','1210','928','913','1003','1203','1161','200','988','735','1293','552','234','90','394','1071','199','67','859','1051','1122','1101','749','1070','849','161','1157','265','510','853','262','612','483','1130','829','940','1235','837','229','1082','147','218','1134','1224','626','867','950','211','1165','495','386','694','441','245','1132','1288','1084','129','1162','340','275','898','1150','1042','307','1160','1055','1039','875','366','1151','954','1124','123','392','628','339','345','112','94','1005','1019','1158','1092','1076','255','284','1086','88','86','850','171','1266','182','881','799','248','1075','429','585','1131','1148','356','910','267','1297','1137','1063','1216','1049','207','460','181','102','63','1246','278','185','1214','1018','1123','104','193','1269','233','1021','1047','141','1008','206','1233','716','398','188','203','243','1068','108','1258','639','974','838','1245','209','1282','1083','152','1276','1002','105','157','1270','686','932','883','1011','1317','1234','599','266','251','536','1035','1061','732','1173','1298','1188','1201','1204','132','1057','172','1097','688','712','168','1271','957','302','598','435','154','281','1109','336','196','390','580','591','572','566','1043','823','1167','1129','1064','1040','845','178','1048','176','379','514','607','672','1119','919','116','873','115','100','1303','918','146','834','1238','1044','1220','459','1199','930','699','695','423','1077','228','1196','1059','600','1133','314','1090','1091','1128','1029','1118','1032','99','92')) ) AND `nattype` IN('physface') AND ((((`value_select` = 'Новый')) AND (`property_id` = '781')) OR (((`value_select` = 'Самара')) AND (`property_id` = '2616'))) GROUP BY `crm_customers`.`id` HAVING COUNT(DISTINCT(`extproperty_values`.`property_id`)) >= 2 ORDER BY extorder ASC LIMIT 0,1000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement