0

Is this even possible?

Demo

Name Country
Rupee India
Dollar USA
Yen Japan
Dollar Canada
Dollar Australia

As you can see, I have a simple table in which name column can have duplicate records.

I want to get all records from the table, but when there are duplicate records, just get country = Canada.

So, result will be,

Name Country
Rupee India
Yen Japan
Dollar Canada

This is question is different from this question: Retrieving the last record in each group - MySQL

In my question, I will receive country name from outside world. Based on country, I need to filter duplicate data.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
micronyks
  • 54,797
  • 15
  • 112
  • 146
  • Why do you want to fetch the row with the Country "Canada"? Is there a specific logic which needs to be applied or should just always hardcoded be taken the "Canada" row? What do to if multiple rows having the same name appear, but none of them have "Canada" as Country? For example, EURO is the currency in both France and Germany, so what to select then? – Jonas Metzler Jan 19 '23 at 10:39

0 Answers0