Subject Re: [ib-support] SQL ORDER BY problem
Author Quinton Marks
I wouldnt know how to do both in the same select statement.

I would use a Stored Procedure with 2 seperate select statements in it, the one (WHere c1=x and c2=y)
And the other (WHERE c1=x) and only execute the second one if the first returned no data.
----- Original Message -----
From: mircostange
To: ib-support@yahoogroups.com
Sent: Thursday, July 25, 2002 11:19
Subject: [ib-support] SQL ORDER BY problem


Hi Everyone,

I am having a problem to find an appropriate SQL select statement for
the following scenario.
I have a table (say A) with columns (say c1, c2, etc). What I need
now is a select statement that returns

all rows with c1=x and c2=y
OR
if no such row exists any c1=x

This doesnt seem to be possible, so I am trying to figure out whether
I can select all rows with c1=x, but
* ordered so that rows with c2=y appear on the top *

It seems that
SELECT * from A where c1=x ordered by c2=y
does not work.

Any alternatives?

Mirco


Yahoo! Groups Sponsor
ADVERTISEMENT



To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


----------

****** Message from InterScan E-Mail VirusWall NT ******

** No virus found in attached file noname.htm
** No virus found in attached file noname.htm

Virus scanned By Foscom Mail Server
***************** End of message ***************



----------

DISCLAIMER:
This email is confidential and intended solely for the use of the individual to whom it is
addressed. Any views or opinions presented are solely those of the author and do not
necessarily represent those of Foscom cc.
If you are not the intended recipient, be advised that you have received this email in
error and that any use, dissemination, forwarding, printing, or copying of this email is
strictly prohibited.
If you have received this email in error please notify Foscom cc. -
by telephone on +27 (0) 11 708-3646, or by return E-mail
We do not accept any responsibility or liability for damage caused by viruses
or any other content contained in this message.



[Non-text portions of this message have been removed]