Re: [SQL] empty set

2006-06-08 Thread Aaron Bono
That will work if foo is never NULL.  If foo takes on a NULL value you will get those records where it is NULL.Is there a reason you cannot do an if/else statement on the list size?  That is what I do on my queries. -AaronOn 6/8/06, Scott Marlowe <[EMAIL PROTECTED]> wrote: On Thu, 2006-06-08 at 16:

Re: [SQL] pgxml & xpath_table

2006-06-08 Thread Jim C. Nasby
There's a good chance the author isn't on this list. You'd be better off on pgsql-general, or just emailing the author of pgxml directly. On Thu, Jun 08, 2006 at 06:00:42PM +0200, Philippe Lang wrote: > Hi, > > I'm playing with the contrib/pgxml library under PG 8.1.4, and I'm not sure > if what

Re: [SQL] empty set

2006-06-08 Thread Scott Marlowe
On Thu, 2006-06-08 at 16:40, CG wrote: > PostgreSQL 8.1 > > I've been trying to write a SQL prepare routine. One of the challenging > elements I'm running into is an empty set ... > > "select foo from bar where foo in ? ;" > > What if "?" is an set with zero elements? What is the proper value to

[SQL] empty set

2006-06-08 Thread CG
PostgreSQL 8.1 I've been trying to write a SQL prepare routine. One of the challenging elements I'm running into is an empty set ... "select foo from bar where foo in ? ;" What if "?" is an set with zero elements? What is the proper value to use to replace "?" indicating an empty set? CG _

Re: [SQL] Query to return modified results at runtime?

2006-06-08 Thread Dias Costa
Hi, You can use the construct Case When but You have to have Your information structured (even if only in Your mind) in order to achive the results You want. So, suposse You have for the color Blue the letter A, for the color Red the letter D, for the color Green the letter B and finally f

Re: [SQL] Concat two fields into one at runtime

2006-06-08 Thread Kenneth B Hill
On Thu, 2006-06-08 at 10:50 -0500, George Handin wrote: > Is there a way using built-in PostgreSQL functions to combine two data > fields into a single field at runtime when querying data? > > For example, the query now returns: > > idfirstlast > --- --- -- > 1 Goerge

[SQL] pgxml & xpath_table

2006-06-08 Thread Philippe Lang
Hi, I'm playing with the contrib/pgxml library under PG 8.1.4, and I'm not sure if what I found with pgxml is a feature of a bug: I've got the following table: CREATE TABLE test ( id int4 NOT NULL, xml varchar(200), CONSTRAINT pk PRIMARY KEY (id) ) WITHOUT OIDS; INS

Re: [SQL] Concat two fields into one at runtime

2006-06-08 Thread Oisin Glynn
George Handin wrote: Is there a way using built-in PostgreSQL functions to combine two data fields into a single field at runtime when querying data? For example, the query now returns: idfirstlast --- --- -- 1 Goerge Handin 2 Joe Rachin I'd like it to re

Re: [SQL] Concat two fields into one at runtime

2006-06-08 Thread Bricklen Anderson
George Handin wrote: Is there a way using built-in PostgreSQL functions to combine two data fields into a single field at runtime when querying data? For example, the query now returns: idfirstlast --- --- -- 1 Goerge Handin 2 Joe Rachin I'd like it to re

Re: [SQL] Concat two fields into one at runtime

2006-06-08 Thread Aaron Bono
select id, first || ' ' || lastfrom mytable;On 6/8/06, George Handin <[EMAIL PROTECTED]> wrote: Is there a way using built-in PostgreSQL functions to combine two datafields into a single field at runtime when querying data? For example, the query now returns:idfirstlast---   ---  --

Re: [SQL] Query to return modified results at runtime?

2006-06-08 Thread Kenneth B Hill
On Wed, 2006-06-07 at 19:29 -0500, George Handin wrote: > I have a query: > > SELECT * FROM testtable; > > Where the results are: > > IDColor > --- --- > 1 Blue > 2 Red > 3 Green > 4 Orange > > How would I rewrite the query to return results where the colors are > rep

Re: [SQL] Query to return modified results at runtime?

2006-06-08 Thread George Handin
Richard Broersma Jr wrote: IDColor --- --- 1 Blue 2 Red 3 Green 4 Orange How would I rewrite the query to return results where the colors are replaced by letters to give the following results? IDColor --- --- 1 A 2 D 3 B 4 C http://www.po

[SQL] Concat two fields into one at runtime

2006-06-08 Thread George Handin
Is there a way using built-in PostgreSQL functions to combine two data fields into a single field at runtime when querying data? For example, the query now returns: idfirstlast --- --- -- 1 Goerge Handin 2 Joe Rachin I'd like it to return: idname ---