pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedSelect by priority again
3+ messages / 2 participants
[nested] [flat]
* Select by priority again
@ 2000-07-24 18:20 Bernie Huang <bernie.huang@ec.gc.ca>
0 siblings, 1 reply; 3+ messages in thread
From: Bernie Huang @ 2000-07-24 18:20 UTC (permalink / raw)
To: PHP Database <php-db@lists.php.net>; pgsql-sql
Sorry about this, but I don't quite get previous postings regarding
select by prioriry.
I have the same question with my sql. I want to be able to select
cell_phone if there is one in the table; otherwise, I will select
work_phone.
table
------
id, name, address, cell_phone, work_phone,...
and I tried using "case when...end" but nope, it's not gonna work. Help
is needed. Thanks.
- Bernie
Attachments:
bernie.huang.vcf (text/x-vcard, 314B) download
begin:vcard
n:Huang;Bernie
tel;fax:(604)664-9195
tel;work:(604)664-9172
x-mozilla-html:TRUE
org:Environment Canada;Standards and Technology Services
adr:;;700-1200 West 73 Ave.;Vancouver;BC;V6P 6H9;Canada
version:2.1
email;internet:bernie.huang@ec.gc.ca
title:Programmer
x-mozilla-cpt:;0
fn:Bernie Huang
end:vcard
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Select by priority again
@ 2000-07-24 19:20 D'Arcy J.M. Cain <darcy@druid.net>
parent: Bernie Huang <bernie.huang@ec.gc.ca>
0 siblings, 1 reply; 3+ messages in thread
From: darcy@druid.net @ 2000-07-24 19:20 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; +Cc: pgsql-sql
[Note: PHP mailing list removed from Cc as this is strictly a
PostgreSQL question I think.]
Thus spake Bernie Huang
> Sorry about this, but I don't quite get previous postings regarding
> select by prioriry.
>
> I have the same question with my sql. I want to be able to select
> cell_phone if there is one in the table; otherwise, I will select
> work_phone.
>
> table
> ------
> id, name, address, cell_phone, work_phone,...
>
> and I tried using "case when...end" but nope, it's not gonna work. Help
> is needed. Thanks.
Exactly what was the SQL statement and which version of PostgreSQL? I
do this in a view and it works.
SELECT CASE WHEN login IS NULL THEN uid::text ELSE login END AS login
FROM account;
--
D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Select by priority again
@ 2000-07-24 21:15 Bernie Huang <bernie.huang@ec.gc.ca>
parent: D'Arcy J.M. Cain <darcy@druid.net>
0 siblings, 0 replies; 3+ messages in thread
From: Bernie Huang @ 2000-07-24 21:15 UTC (permalink / raw)
To: pgsql-sql
"D'Arcy J.M. Cain" wrote:
> [Note: PHP mailing list removed from Cc as this is strictly a
> PostgreSQL question I think.]
>
> Thus spake Bernie Huang
> > Sorry about this, but I don't quite get previous postings regarding
> > select by prioriry.
> >
> > I have the same question with my sql. I want to be able to select
> > cell_phone if there is one in the table; otherwise, I will select
> > work_phone.
> >
> > table
> > ------
> > id, name, address, cell_phone, work_phone,...
> >
> > and I tried using "case when...end" but nope, it's not gonna work. Help
> > is needed. Thanks.
>
> Exactly what was the SQL statement and which version of PostgreSQL? I
> do this in a view and it works.
>
> SELECT CASE WHEN login IS NULL THEN uid::text ELSE login END AS login
> FROM account;
>
> --
> D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves
> http://www.druid.net/darcy/ | and a sheep voting on
> +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
hi, thanks for the help. I will avoid to CC to the wrong list.
- Bernie
Attachments:
bernie.huang.vcf (text/x-vcard, 314B) download
begin:vcard
n:Huang;Bernie
tel;fax:(604)664-9195
tel;work:(604)664-9172
x-mozilla-html:TRUE
org:Environment Canada;Standards and Technology Services
adr:;;700-1200 West 73 Ave.;Vancouver;BC;V6P 6H9;Canada
version:2.1
email;internet:bernie.huang@ec.gc.ca
title:Programmer
x-mozilla-cpt:;0
fn:Bernie Huang
end:vcard
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2000-07-24 21:15 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-24 18:20 Select by priority again Bernie Huang <bernie.huang@ec.gc.ca>
2000-07-24 19:20 ` D'Arcy J.M. Cain <darcy@druid.net>
2000-07-24 21:15 ` Bernie Huang <bernie.huang@ec.gc.ca>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox