RE: [SQL] select an entry with a NULL date field

2000-08-14 Thread Henry Lafleur
Comparing anything = NULL (if it would work) would always false, at least that's how other servers treat it. You have to use IS NULL. select entry_id from tbl_date where date_02 IS NULL; Henry -Original Message- From: Web Manager [mailto:[EMAIL PROTECTED]] Sent: Monday, August 14, 2000

RE: [SQL] SQL (table transposition)

2000-08-04 Thread Henry Lafleur
Hi, When I saw cross tab, I realized that I'd done this before. If you know what your keys are ahead of time, you can write the query. Otherwise, you can write a program go generate the query by looking at the distinct list of keys and generating code as follows. The code generator would only h

RE: [SQL] Simple concatenation in select query

2000-07-31 Thread Henry Lafleur
PostgreSQL has a string concatenation operator (see operators in the manual): SELECT last_name||', '||first_name FROM ... Here's a ref: http://www.postgresql.org/docs/user/x2129.htm Henry -Original Message- From: Sandis [mailto:[EMAIL PROTECTED]] Sent: Monday, July 31, 2000 2:48 PM To

RE: RE: Re(2): [SQL] optimize sql

2000-07-28 Thread Henry Lafleur
I'm kind of new to pgsql, but as long as MAX works for boolean fields, they you can just change the first query below with: HAVING MAX(active) != 't' but it seems that pgsql can have user defined aggregates, so you could define a function that computes the MAX of a boolean and define true to be

RE: Re(2): [SQL] optimize sql

2000-07-27 Thread Henry Lafleur
If you know that 't' will always be the highest character in the active field for all records: SELECT name FROM office, office_application WHERE code = office_code GROUP BY name HAVING MAX(active) < 't' Of course, if you have an active that is 'z' for example, then this won't work. I think this

RE: [SQL] join if there, blank if not

2000-07-13 Thread Henry Lafleur
, 96 MB of RAM, and a slow IDE HD.) Henry -Original Message- From: Patrick Jacquot [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 13, 2000 5:59 AM To: [EMAIL PROTECTED] Subject: Re: [SQL] join if there, blank if not Henry Lafleur wrote: > Jacques, > > The problem with using th

RE: [SQL] join if there, blank if not

2000-07-12 Thread Henry Lafleur
Jacques, The problem with using the union in this way is that you get NULLs for a number weather or not it has an associated record in calls. To do a pure outer join, it would be something like this: select c.cdate, c.ctime, c.cextn, c.cnumber, n.ndesc from calls c, numbers n where c.cnumber=n.