Hi, can someone please explain something to me.
SET @NAMEID = '14359'
IF @ADR2 IS NULL AND @ADR3 IS NULL
SELECT ADR1, POSTAL_CODE, (STATE_NAME) AS COUNTRY
FROM PAT_NAMES_ADDRESS P, STATE_NAME S
WHERE P.NAME_ID = @nameid
AND P.STATE_ID = S.STATE_ID
AND P.CURRENT_ONE = '1'
AND P.LANGUAGE_ID = '3'
In the Pat_names_address table, only one record can be current, if there are more the current = 0.
When i run the folowing code, I get 10 records back instead of one, all showing different countries, but the same addresses.
But I want the record where current one = 1, so obviously it should only return one record as in my code.
Why am I getting 10 different coutries?