|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem selecting duplicate values.THIS IS THE PART OF THE TABLE I HAVE 18 2 Bytes Per Cluster 19 2 Drive Type 20 2 File System Type 21 2 Free Clusters 22 2 Free Space 23 2 Letter 24 2 Name 25 2 Percent Used 26 2 Sectors Per Cluster 27 2 Serial Number 28 2 Total Clusters 29 2 Total Space 30 2 Used Space 31 3 Log File Name 32 3 Message 33 3 Source Name 34 3 Time Generated 35 4 Install Date 36 4 Install Location 37 4 Manufacturer 38 4 Name 39 4 Product ID 40 4 Registered Company 41 4 Registered Owner 42 4 Version 43 5 Install Date 44 5 Name 45 5 Version 46 6 Installed? 47 6 Name 48 6 Version I want to select all the values in the third column that repeat, but I also want the value in the second column with it. For example this is what I should get with the sample I provided. 2 Name 4 Name 4 Version 5 Name 5 Version 6 Name 6 Version I can't seem to get the logic right on this one, I'm a beginner so help me out on this one please! Use a subquery:
SELECT col2, col3 FROM table WHERE col3 IN (SELECT col3 FROM table GROUP BY col3 HAVING COUNT(*) > 1) HTH, Stu |
|||||||||||||||||||||||