Am trying to access 2 tables values to single query. For Eg Customer name, id, Address to a single query. Customer address - State & Country in another table Am trying to access all address to a single column in the query. In Customer table state and country code only stored. Now I can able to access Customer name, Id, Address(Single column) all in query but cont able to access that State & Country.
SELECT CustomerName, CustomerId, (BFlatNo +','+ BPremises +','+ BStreet +','+ BArea +','+ BLocation +','+ BCity +','+ BState +','+ BCountry) as Address FROM Customer WHERE CustomerId=11;
this code working successful & got result this
Am getting 24 and 1 are id's of State & Country.
so Again I modify this code to get exact address in a single column state delhi instead off 24 and country india instead of 1
SELECT CustomerName, CustomerId, (BFlatNo +','+ BPremises +','+ BStreet +','+ BArea +','+ BLocation +','+ BCity +','+ BState +','+ (select CountryName from Country where CountryIdId=Customer.Country) AS Country) AS Address FROM Customer;
this code showing syntax error ! How to solve this ?