single
Unique values from multiple columns
メニューを表示するにはスワイプしてください
But what if we want to know, for example, unique pairs 'country-city' of our site visitors? Surely, we can extract unique countries (like in the previous chapter) and unique cities. But then we have to connect each city to the country manually.
This task can be solved by the same DISTINCT, but this time with two columns. For example,
12SELECT DISTINCT(country), city FROM visitors
The
DISTINCTstatement will return all the unique combinations of columns you chose. Using parentheses is not mandatory, i.e. you for the example above you can writeDISTINCT country, city. But placing multiple columns withinDISTINCTparentheses will return only one column of all unique combinations in(country, city)format.
スワイプしてコーディングを開始
Extract all unique combinations of model and transmission
解答
フィードバックありがとうございます!
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください