mysql - Select with inner distincts -


I use MSSQL and I like a table:

  id. Value1 Value 2 1 | ABC | AAA 2 | ABC | AAA 3 | XYZ | AAA 4 | ABC | BBB5 | ABC | BBB 6 | ABC | BBB  

Now I want to calculate on the basis of value2 how many times I have the same entry in value 1. In practice, I need a resultant selection like the following:

  Value2 | Value1 Calculation AAA | ABC | 2 AAA XYZ | 1 BBB ABC | 3  

I hope that its obvious enough? It should work with 2 distinctions, okay?

  select value, value 1, count (*) from table 1 group to value 2, value 1  


Comments