OR operator in select list?

OR operator in select list?

Post by Joe Clark » Thu, 25 Jul 2002 04:10:53



I'm trying to something like this to work, but I keep getting "Invalid
syntax near keyword 'OR'"?

SELECT Cust.Promo OR Item.Promo AS IsPromo

FROM Cust INNER JOIN Orders ON Cust.CustID = Orders.CustID
INNER JOIN OrderItem ON Orders.OrderID = OrderItem.OrderID
INNER JOIN Item ON OrderItem.ItemID = Item.ItemID

Forget the 'FROM' clause, the problem's in using 'OR' in the select list.

First, can this be done, and second, what would be the correct syntax?

TIA,

Joe

 
 
 

OR operator in select list?

Post by Joe Clark » Thu, 25 Jul 2002 04:16:48


Maybe I solved my own problem by reading BOL a little more carefully.  I
think I'll try bitwise OR ( | ).

Joe


Quote:> I'm trying to something like this to work, but I keep getting "Invalid
> syntax near keyword 'OR'"?

> SELECT Cust.Promo OR Item.Promo AS IsPromo

> FROM Cust INNER JOIN Orders ON Cust.CustID = Orders.CustID
> INNER JOIN OrderItem ON Orders.OrderID = OrderItem.OrderID
> INNER JOIN Item ON OrderItem.ItemID = Item.ItemID

> Forget the 'FROM' clause, the problem's in using 'OR' in the select list.

> First, can this be done, and second, what would be the correct syntax?

> TIA,

> Joe


 
 
 

1. Why i can't use logical operator in select list?

This is very simple why can't use logical operator in
select list?

    select title, (price> 20.00) from titles

My query is a bit larger than the query above. I really
don't understand... i've been programming SQL Server last
3 years.  And this limitation surprise me!

I need show -1, 0 without the clause WHEN.  Please, tell
me your opinions.

Regards to all,
Mario

2. Database Transfer

3. select list in list field

4. ** Remote Setup of SQL Server Database *****

5. Fill Combo List using Criteria selected in another Combo List

6. Rounding

7. Updating a combo box list W/limit to list selected

8. Admin not accepted as member of any group when running JPWin98

9. Fill Combo List using Criteria selected in another Combo List

10. Select List from DB for Label List

11. Toggling Between List Boxes at the Same Location and Selecting Records in Each List Box

12. listing ALL OPERATORS form t-sql

13. Operator mismatch with list