Hello,
SELECT discounts.*, discounttype AS Expr1
FROM discounts
WHERE (discounttype = 'Initial & Customer')
This query in pub database does not bring anything because of ‘&’ in where
clause. How can I get this working without removing & in the table?
Thanks,
Jim.
not sure, why do you want to do that. but if you are using "=" equal
operator for comparison then query will look for exact match in the table.
If exact match is not found then you will not retrieve any row.
either change source data or change the value that is being passed in where
clause.
you may try something as follows:
SELECT discounts.*, discounttype AS Expr1
FROM discounts
WHERE replace(discounttype, ' ', ' & ') = 'Initial & Customer'
Vishal Parkar
vgparkar@.yahoo.co.in | vgparkar@.hotmail.com
|||pubs.dbo.discounts has a row where discounttype = 'Initial Customer' If
you want the row because it contains Initial and Customer, then you can
try something like
select ...
from discounts
where discounttype like '%Initial%' and discounttype like '%Customer'
I'm not sure what the point of the string 'Initial & Customer' is.
SK
JIM.H. wrote:
>Hello,
>SELECT discounts.*, discounttype AS Expr1
>FROM discounts
>WHERE (discounttype = 'Initial & Customer')
>This query in pub database does not bring anything because of ‘&’ in where
>clause. How can I get this working without removing & in the table?
>Thanks,
>Jim.
>
>
No comments:
Post a Comment