Re: [GENERAL] Check for an empty result

2009-02-15 Thread Eus
Hi Andreas! --- On Fri, 2/13/09, A. Kretschmer wrote: > In response to Eus : > > Hi Ho! > > > > Is there a way to check whether or not a subquery > returns an empty result set? > > You can use EXISTS for that: > > -- empty result > test=*# select * from (select 1 where 1=2) foo; > ?column? >

Re: [GENERAL] Check for an empty result

2009-02-15 Thread Eus
Hi Craig! --- On Fri, 2/13/09, Craig Ringer wrote: > Eus wrote: > > Hi Ho! > > > > Is there a way to check whether or not a subquery > returns an empty result set? > > "EXISTS" > > SELECT blah FROM blah WHERE EXISTS (SELECT 1 FROM tablename > WHERE ...); Thank you. Previously I tried: "... W

Re: [GENERAL] Check for an empty result

2009-02-13 Thread A. Kretschmer
In response to Eus : > Hi Ho! > > Is there a way to check whether or not a subquery returns an empty result set? You can use EXISTS for that: -- empty result test=*# select * from (select 1 where 1=2) foo; ?column? -- (0 rows) -- check if a result exists test=*# select exists(select *

Re: [GENERAL] Check for an empty result

2009-02-13 Thread Craig Ringer
Eus wrote: > Hi Ho! > > Is there a way to check whether or not a subquery returns an empty result set? "EXISTS" SELECT blah FROM blah WHERE EXISTS (SELECT 1 FROM tablename WHERE ...); > postgre check "empty result set" It's not "postgre". It's PostgreSQL, or "postgres". This matters when you'r

[GENERAL] Check for an empty result

2009-02-13 Thread Eus
Hi Ho! Is there a way to check whether or not a subquery returns an empty result set? Googling with the following keywords does not help: postgre check "empty result set" sql check empty result Thank you. Best regards, Eus (FSF member #4445) In this digital era, where computing technology is