1

クエリ:

  select distinct (Customer) ,CustomerID from history where Customer != '' and        Customer LIKE 'Ram%';

結果:

      Ramer ram100
      Raman ra45
      Raman ra45
4

2 に答える 2

3

と を使っMAXてみてくださいgroup by

 select Customer, MAX(CustomerID) CustomerID
 from   history
 where  Customer != '' AND Customer LIKE 'Ram%'
 GROUP BY Customer 
于 2012-11-26T08:40:20.943 に答える
0

すべての顧客 ID も表示する場合は、次を使用します。group_concat

select customer, group_concat(distinct customerid)
from history
where Customer != '' and Customer like 'Ram%'
group by customer
于 2012-11-26T08:48:34.627 に答える