It would be something like

SELECT 
CASE A.status
WHEN B.status THEN B.status
WHEN C.status THEN C.status
FROM yourTable

I think that's what you are after.
________________________________
Taco Fleur - E-commerce Development Manager
Shelco Searches & Services
An Authorised ASIC Information Broker
www.shelco.com.au
Ph: + 61 7 3236 2605

-----Original Message-----
From: Roberto Perez [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 20 July 2005 9:21 AM
To: CF-Talk
Subject: "or" operator in WHERE statement

Hi all,

Quick question: is "OR" a valid operator in a WHERE statement?

I have a main table A with a 'status' field which value can be either 'open'
or 'closed'. Then I have a table B where the 'status' field is 'open' by
default (not editable), and a table C where the 'status' field is 'closed'
by default (not editable).

I thought that if my WHERE statement was:

WHERE A.status = B.status OR A.status = C.status

......I would get data from either B or C, according to the value of 'status'
in table A. In other words, I though if the first condition was not met, the
second condition would be parsed and executed. But what happens is that the
field that is defined first in the SELECT statement is the one that is
always displayed in my output, regardles of whether the value of 'status' in
table A is 'open' or 'closed'.

If OR is not a possible operator, any idea how to achieve what I'm trying to
do (i.e., for the query to bring data from one table or the other according
to the value of a single shared field)? I tried joins with no good results
either...

Thanks in advance,

Roberto Perez



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212275
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to