Re: [SQL] select vs. select count

2007-03-30 Thread Claus Guttesen
> select order_id from > (select o.order_id from orders o join order_lines ol using (order_id) > where o.time > '2006-01-01T00:00' and o.time < '2007-01-01T00:00' > and (ol.item_id = 10 or ol.item_id = 11 or ol.item_id = 12) group by > o.order_id) as prints > inner join > (select ho.order_

Re: [SQL] select vs. select count

2007-03-27 Thread Tom Lane
"Claus Guttesen" <[EMAIL PROTECTED]> writes: > select order_id from > (select o.order_id from orders o join order_lines ol using (order_id) > where o.time > '2006-01-01T00:00' and o.time < '2007-01-01T00:00' > and (ol.item_id = 10 or ol.item_id = 11 or ol.item_id = 12) group by > o.order_id) a

Re: [SQL] select vs. select count

2007-03-27 Thread Peter Eisentraut
Claus Guttesen wrote: > Why does select and select(count) produce two different results? count(expression) only counts nonnull values. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end of broadcast)--- TIP 2: Don't 'kill -9' the

Re: [SQL] select vs. select count

2007-03-27 Thread Claus Guttesen
Forgot to mention that this is on postgresql 7.4.14 and FreeBSD 6.2. regards Claus Hi. I'm performing the following query to get all items sold in 2006 which are in category prints or gifts, but not in extra: select order_id from (select o.order_id from orders o join order_lines ol using (or

[SQL] select vs. select count

2007-03-27 Thread Claus Guttesen
Hi. I'm performing the following query to get all items sold in 2006 which are in category prints or gifts, but not in extra: select order_id from (select o.order_id from orders o join order_lines ol using (order_id) where o.time > '2006-01-01T00:00' and o.time < '2007-01-01T00:00' and (ol.ite