search

Home  >  Q&A  >  body text

mysql statement writing

A table has six fields ABCDEF. The requirement is to find out whether ABCD is consistent and merge it into one, and count how many different E's there are in the merged entries.
In other words, abcd is the same as one piece of data. Then abcd the same multiple pieces of data to e to deduplicate, the result is probably like this
ABCD2
How to write such a sql statement

漂亮男人漂亮男人2816 days ago668

reply all(2)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-18 10:51:22

    select a,b,c,d,count(distinct(e)) from t group by a,b,c,d

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-18 10:51:22

    select *,count(distinct A) from table group by A,B,C,D;

    Try it.

    reply
    0
  • Cancelreply