I have table which contains the ids like -
id
o1
o2
o3
now another table contains price for these ids based on the country like
id country price
o1 IND 11
o1 US 10
o1 default 9
o2 default 2
o3 UK 4
o3 default 3
basically i have to write a stored procedure where i will pass the region as parameter. for example if region is UK then i want select rows as follows if there is match then select the row otherwise default row.
id country price
o1 default 9
o2 default 2
o3 UK 4
Can you please suggest a good and efficient way of writing in SQL?