|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Filtering out duplicate values
I'm filtering a large table.. one of the fields is filtered by the expression: <>"" AND <>"NA" it works fine, but now I need to filter that same field so that it doesnt include any values that repeat.. what do i need to add to the expression to do this?
Thanks, Alan |
|
#2
|
|||
|
|||
|
I'm not sure I understand what you want. You want all rows exclude where values in that specific column occur more then once?
This should work (not tested) SELECT * FROM table WHERE col1 <> "" AND col1 <> "NA" AND col1 NOT IN (SELECT col1 FROM table1 GROUP BY col1 HAVING count(*) > 1); But this will remove any row where the content of col1 exists more then once (it will not even return one of those rows) |
|
#3
|
|||
|
|||
|
use "Not Exist" instead of "Not In" to avoid full table scan.
(if shammat's code is working) |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Filtering out duplicate values |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|