help with select statement condition
Posted on 2013-05-17
In my MoreAddresses table I have a column called "AddressNumber"
SELECT UserID, AddressNumber, Address, City, State
WHERE (UserID = 14920)
Every UserID will at minimum have one record where addressnumber = 0. Some userID's may or may not have an additional record where addressnumber = 1.
I want my query to return 1 record, using this logic:
"If the len(address) >1 (i.e. there is a record there) where adressnumber =1, then show the record with addressnumber =1, otherwise show the record where addressnumber = 0"