LIKE And AS Text Results
I am trying to figure out how to run a query in MySQL that will do the
following:
Search for any number that begins with 5 and have the result in a column
labeled classRef and the resulting text be FOO
If that number begins with anything other than 5 have it output to the
column classRef and the resulting text be BAR.
This is what I have so far:
SELECT
ara.AddressNumber AS ExternalID,
ara.AddressNumber as tranId,
cus.Name AS customerRef,
cus.ExternalID LIKE '5%' AS classRef,
cus.ExternalID NOT LIKE '5%' AS classRef2,
'1' AS itemLine_quantity,
'0' AS itemLine_salesPrice
FROM
adrun_copy ara,
customers_copy cus
WHERE
ara.AAccountNumber = cus.ExternalID
No comments:
Post a Comment