クエリ:
select distinct (Customer) ,CustomerID from history where Customer != '' and Customer LIKE 'Ram%';
結果:
Ramer ram100
Raman ra45
Raman ra45
と を使っMAX
てみてくださいgroup by
。
select Customer, MAX(CustomerID) CustomerID
from history
where Customer != '' AND Customer LIKE 'Ram%'
GROUP BY Customer
すべての顧客 ID も表示する場合は、次を使用します。group_concat
select customer, group_concat(distinct customerid)
from history
where Customer != '' and Customer like 'Ram%'
group by customer