色んなSQLをSquerylで書くと? のパクリです。
テーブル名とかカラム名はちょっと弄りました。
SELECT *
FROM User u
LEFT JOIN Group g on (u.groupId = g.id)
WHERE g.id IS NULL
select
.from(User as u)
.leftJoin(Group as g).on(u.groupId, g.id)
.where.isNull(g.id)
SELECT *
FROM User u
WHERE EXISTS (
SELECT g.id
FROM Group g
WHERE u.groupId = g.id
)
select
.from(User as u)
.where.exists(
select(g.result.id)
.from(Group as g)
.where.eq(u.groupId, g.id)
)
(注) 1.6.1 から
SELECT u.groupId, u.teamId, count(*)
FROM User u
GROUP BY u.groupId, u.teamId
select(u.result.groupId, u.result.teamId, sqls.count)
.from(User as u)
.groupBy(u.groupId, u.teamId)