在选择语句中排除添加ID

时间:2018-11-28 07:05:42

标签: node.js postgresql typeorm

我需要使用typeorm复制它

SELECT user_id 
FROM users 
WHERE created_at >= '2018-11-01 00:00:00' AND '2018-11-30 23:59:59' >= created_at

我正在使用以下查询:

SELECT "slots"."starttime",count(event.id) FROM "calendar_event" 
"event" LEFT JOIN "slot_unit" "slots" ON "slots"."belongsToEventId"="event"."id" 
WHERE "event"."belongsToOrganization" = '062ddf75-ed40-4c63-9d81-b1091389a15c' 
AND "event"."deletedAt" IS NULL AND slots.startTime::timestamp without 
time zone >= '2018-08-29 12:00:00.025047'::timestamp without time zone 
AND slots.endTime::timestamp without time zone <= '2018-08-29 13:00:00.025047'::
timestamp without time zone GROUP BY "slots"."starttime" 
ORDER BY "slots"."starttime" ASC

add select会将槽位ID继续添加到选择短语中。这会导致语法错误

0 个答案:

没有答案