export const incident = pgTable('incidents', {
id: serial('id').primaryKey(),
title: text('title').notNull(),
});
export const incidentUpdates = pgTable('incident_updates', {
id: serial('id').primaryKey(),
incidentId: integer('incident_id').references(() => incidents.id),
description: text('description').notNull(),
lastUpdatedTimestamp: timestamp('last_updated_timestamp').defaultNow(),
status: text('status').notNull(),
});
我如何使用drizzle orm无需求助于RAW SQL,可以复制上述SQL查询,该查询选择最新的IDDIST_UPDATE,每个事件中的最新Inscort_update?有没有办法使用Drizzle的查询构建器方法执行此查询类型? -stack:
postgresql,毛毛雨orm,typescript
我只是在教程中看到了一个例子。 我在这里粘贴了教程的示例:
在您的情况下,这将是类似的事情,但可使用的是事件,并且用户限制可以是INDAST_UPDATES,并且左联接条件将在事件中。ID和INDACT_UPDATES.incident.Incident_ID. https://orm.drizzle.team/docs/joins#aliases-selfjoins
当您的左键内有更多特定条件 (使用。