Re: [SQL] To having or not to having?

2011-10-23 Thread Ferruccio Zamuner
On 10/23/11 23:12, I wrote: Hello, I'm rusty with SQL and I've started to practice it again but I'm falling on this issue. I've found first solution using WINDOWING: SELECT d.pintime, d.a_id, d.c_id, d.value, d.id, d.sincedate, d.todate, d.description, d.genre FROM (SELECT pintime,a_

[SQL] To having or not to having?

2011-10-23 Thread Ferruccio Zamuner
Hello, I'm rusty with SQL and I've started to practice it again but I'm falling on this issue. The problem: Extracting rows from 'b' table trapping min() of a calculated value "days" on 'a' table and a parameter. SELECT b.*, $1::date-a.sincedate AS "days" FROM b, a WHERE pintime