If I have a table T which has two columns, as shown in:
A |
B |
1 |
3 |
1 |
3 |
2 |
5 |
2 |
4 |
3 |
7 |
3 |
7 |
|
|
Where a column value of 1 corresponds to the B column value of the 3,a column value of 2 corresponds to the value of column B is two, one is 5, one is 4, we are to List 2 5,2 4 of this two records.
The first method uses the Max and Min functions smartly, and when we use the A-column grouping, if Max (b) =min (b), then all the values of column B are definitely the same. The reverse is the record we need to find. SQ is as follows:
Select * from where inch (Selectfromgroupby haveMax(TI.B) <> min (TI.B))
You can also use another notation
Select * from where inch (Select fromGroup ,selectdistinct by TI.A Having count (ti.b) >1
The above method first removes the duplicate columns in a, B, and then, based on the column A, calculates the number of different values in column A, which compares the above one to add a SELECT, more complex!
Not enough to find the internal select can be removed, the simplified version is as follows:
Select * from where inch (Selectfrom Group by ti.a have Count(distinct ti.b)>1
Look for a record with the same column in the datasheet and another column with different values