Re: [SQL] Doing a conditional aggregate (e.g. count(*) if x=y) in postgres?

2007-05-14 Thread Geoff Tolley
Bryce Nesbitt wrote: All; Is there a way to get a conditional aggregate? I have this two column view: SELECT count(*) AS count, xx_plan.plan_name FROM xx_membership JOIN xx_account USING (account_id) JOIN xx_plan USING (plan_id) WHERE xx_membership.status = 10 GROUP BY xx_plan.pla

Re: [SQL] selecting random row values in postgres

2007-02-23 Thread Geoff Tolley
Tommy Gildseth wrote: Sumeet wrote: Thanks Buddy, really appreciate ur help on this problem solved... Is there any way this query can be optimized...i'm running it on a huge table with joins ORDER BY rand() is rather slow on large datasets, since the db has to actually generate a rando

Re: [SQL] Differentiate Between Zero-Length String and NULLColumn Values

2007-01-30 Thread Geoff Tolley
Andrew Sullivan wrote: AFAIK they don't accept the latter any more than we do. But again, I'm an Oracle ignoramous. I _do_ know that people of my acquaintance who have historically only developed against Oracle have given me queries with things like value = '' in it, and been surpr