-
Notifications
You must be signed in to change notification settings - Fork 20
Having count(*) #33
Comments
I found it !!! I must use var dataset = db.fetch("SELECT * FROM t1 JOIN t2 ON t1k=t2k JOIN t3 ON t2k=t3k WHERE t3attr=? AND t2attr=? AND t1attr=?", parameters.A, parameters.B, parameters.B); second : dataset = dataset.groupAndCount('t1k').having({count : {gte : num}}).where('t3attr in {elements}', {elements: parameters.C}); when I use SELECT * FROM t1 JOIN t2 ON t1k=t2k JOIN t3 ON t2k=t3k WHERE t3attr='xxxx' AND t2attr='yyyy' AND t1attr='yyyy' I don't have the Thank you |
Hi, sorry took so long to get back to you. The issue with providing the sql to begin with is that To write the sql using the api you could do something like the following. var dataset = db
.from("t1")
.join("t2", {t2k : sql.identifier("t1k")})
.join("t3", {t3k : sql.identifier("t2k")})
.where({t3attr : parameters.A, t2Attr : parameters.B, t1Attr : parameters.C });
var ds = dataset.groupAndCount('t1k')
.having({count : {gte : 10}}) //or whatever number you want
.where('t3attr in {elements}', {elements: parameters.C}); -Doug |
Thank you !! It works nice now :) |
Hello, I've a issue with the having clause. I want to make a sql request like
How I can do that with your patio module !
The text was updated successfully, but these errors were encountered: