Ask a Question related to ASP, Design and Development.
-
atse #1
select all the duplicate records
Hi,
My table in the database may contain duplicate records, which means except
the primary key (auto_increment) field is unique, all or almost of all the
fields are with the same content. How can I select them to display and
delete them?
Thanks for any idea.
Atse
atse Guest
-
Duplicate records
Hi I don't know if this is the best way to query for duplicate records but this works. If someone has a better idea to do this please feel free to... -
Return Records and not duplicate them :: Again
I will finish the post this time... I need help on the following situation. I have a solution in ASP/VB Script where I query a RecordSet for... -
Deleting duplicate records
Jon, You didnt supply the DDL, so I can only point to existing practices to remove duplicate records.Here they are: INF: How to Remove... -
Need help serializing duplicate records
Hi everyone...hope you can help! We have a single database containing contact info for individuals and their companies. There are about 8000... -
Duplicate records?
Hi Shai Use field validation to ensure that entries are unique, with a custom message to tell the user what to do if they aren't. Bridget Eley... -
Ken Schaefer #2
Re: select all the duplicate records
SELECT
Field1, Field2, Field3
FROM
myTable
GROUP BY
Field1, Field2, Field3
HAVING
Count(*) > 1
Cheers
Ken
"atse" <dunggaze@yahoo.com> wrote in message
news:no4jb.112560$ko%.54876@news04.bloor.is.net.ca ble.rogers.com...
: Hi,
:
: My table in the database may contain duplicate records, which means except
: the primary key (auto_increment) field is unique, all or almost of all the
: fields are with the same content. How can I select them to display and
: delete them?
: Thanks for any idea.
:
: Atse
:
:
Ken Schaefer Guest
-
atse #3
Re: select all the duplicate records
Cool, thanks
"Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
news:eOFYCytkDHA.3316@tk2msftngp13.phx.gbl...except> SELECT
> Field1, Field2, Field3
> FROM
> myTable
> GROUP BY
> Field1, Field2, Field3
> HAVING
> Count(*) > 1
>
> Cheers
> Ken
>
> "atse" <dunggaze@yahoo.com> wrote in message
> news:no4jb.112560$ko%.54876@news04.bloor.is.net.ca ble.rogers.com...
> : Hi,
> :
> : My table in the database may contain duplicate records, which meansthe> : the primary key (auto_increment) field is unique, all or almost of all> : fields are with the same content. How can I select them to display and
> : delete them?
> : Thanks for any idea.
> :
> : Atse
> :
> :
>
>
atse Guest
-
atse #4
Re: select all the duplicate records
This lists all the duplicates only with one of each. If the record has more
than one duplicate, it can't show all of them but one only. Is there a way
to show all? Thanks again.
Atse
"Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
news:eOFYCytkDHA.3316@tk2msftngp13.phx.gbl...except> SELECT
> Field1, Field2, Field3
> FROM
> myTable
> GROUP BY
> Field1, Field2, Field3
> HAVING
> Count(*) > 1
>
> Cheers
> Ken
>
> "atse" <dunggaze@yahoo.com> wrote in message
> news:no4jb.112560$ko%.54876@news04.bloor.is.net.ca ble.rogers.com...
> : Hi,
> :
> : My table in the database may contain duplicate records, which meansthe> : the primary key (auto_increment) field is unique, all or almost of all> : fields are with the same content. How can I select them to display and
> : delete them?
> : Thanks for any idea.
> :
> : Atse
> :
> :
>
>
atse Guest
-
Bob Barrows #5
Re: select all the duplicate records
Is this Access? I suggest using Ken's SQL to create a saved query called
qFindDups. Then create another query using this SQL:
Select t.* FROM myTable t INNER JOIN qFindDups q
ON t.Field1=q.Field1 AND t.Field2=q.Field2 AND t.Field3=q.Field3
HTH,
Bob Barrows
"atse" <dunggaze@yahoo.com> wrote in message
news:CBpjb.349225$Lnr1.181374@news01.bloor.is.net. cable.rogers.com...more> This lists all the duplicates only with one of each. If the record has> than one duplicate, it can't show all of them but one only. Is there a way
> to show all? Thanks again.
>
> Atse
>
>
> "Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
> news:eOFYCytkDHA.3316@tk2msftngp13.phx.gbl...> > SELECT
> > Field1, Field2, Field3
> > FROM
> > myTable
> > GROUP BY
> > Field1, Field2, Field3
> > HAVING
> > Count(*) > 1
> >
> > Cheers
> > Ken
Bob Barrows Guest
-
atse #6
Re: select all the duplicate records
I am using MySQL. This doesn't work, which complains with myTable.qfinddups
doesn't exist.
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
news:OrID4T9kDHA.2436@TK2MSFTNGP09.phx.gbl...way> Is this Access? I suggest using Ken's SQL to create a saved query called
> qFindDups. Then create another query using this SQL:
>
> Select t.* FROM myTable t INNER JOIN qFindDups q
> ON t.Field1=q.Field1 AND t.Field2=q.Field2 AND t.Field3=q.Field3
>
> HTH,
> Bob Barrows
>
>
> "atse" <dunggaze@yahoo.com> wrote in message
> news:CBpjb.349225$Lnr1.181374@news01.bloor.is.net. cable.rogers.com...> more> > This lists all the duplicates only with one of each. If the record has> > than one duplicate, it can't show all of them but one only. Is there a>> > to show all? Thanks again.
> >
> > Atse
> >
> >
> > "Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
> > news:eOFYCytkDHA.3316@tk2msftngp13.phx.gbl...> > > SELECT
> > > Field1, Field2, Field3
> > > FROM
> > > myTable
> > > GROUP BY
> > > Field1, Field2, Field3
> > > HAVING
> > > Count(*) > 1
> > >
> > > Cheers
> > > Ken
>
atse Guest
-
Bob Barrows #7
Re: select all the duplicate records
Does MySQL allow subqueries in the FROM clause? If so, do this:
Select t.* FROM myTable t INNER JOIN
(
SELECT
Field1, Field2, Field3
FROM
myTable
GROUP BY
Field1, Field2, Field3
HAVING
Count(*) > 1
) q
ON t.Field1=q.Field1 AND t.Field2=q.Field2 AND t.Field3=q.Field3
Please let us know upfront what database you are using so we don't waste our
time and yours giving you irrelevant solutions.
Bob Barrows
atse wrote:> I am using MySQL. This doesn't work, which complains with
> myTable.qfinddups doesn't exist.
>
>
> "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:OrID4T9kDHA.2436@TK2MSFTNGP09.phx.gbl...>> Is this Access? I suggest using Ken's SQL to create a saved query
>> called qFindDups. Then create another query using this SQL:
>>
>> Select t.* FROM myTable t INNER JOIN qFindDups q
>> ON t.Field1=q.Field1 AND t.Field2=q.Field2 AND t.Field3=q.Field3
>>
>> HTH,
>> Bob Barrows
>>
>>
>> "atse" <dunggaze@yahoo.com> wrote in message
>> news:CBpjb.349225$Lnr1.181374@news01.bloor.is.net. cable.rogers.com...>>> This lists all the duplicates only with one of each. If the record
>>> has more than one duplicate, it can't show all of them but one
>>> only. Is there a way to show all? Thanks again.
>>>
>>> Atse
>>>
>>>
>>> "Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
>>> news:eOFYCytkDHA.3316@tk2msftngp13.phx.gbl...
>>>> SELECT
>>>> Field1, Field2, Field3
>>>> FROM
>>>> myTable
>>>> GROUP BY
>>>> Field1, Field2, Field3
>>>> HAVING
>>>> Count(*) > 1
>>>>
>>>> Cheers
>>>> Ken
Bob Barrows Guest
-
atse #8
Re: select all the duplicate records
Sorry, I will complete my question next time.
I guess MySQL may not support substring? Because it complains with that:
Microsoft OLE DB Provider for ODBC Drivers error '80040e09'
[MySQL][ODBC 3.51 Driver][mysqld-4.0.5-beta-max-nt]You have an error in your
SQL syntax. Check the manual that corresponds to your MySQL server version
for the right syntax to use near 'SELECT f1, f3(
/dp_record.asp, line 37
Here is the line37 (please ignore the broken lines):
' file is myTable, and f1, f3 ... are the field names
dataSQL = "select t.* FROM file t INNER JOIN (SELECT f1, f3, f5 FROM file
GROUP BY f1, f3, f5 "
dataSQL = dataSQL & "HAVING Count(*) > 1) q ON t.f1=q.f1 AND t.f3=q.f3 AND
t.f5=q.f5"
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
news:ukoS84JlDHA.2732@TK2MSFTNGP11.phx.gbl...our> Does MySQL allow subqueries in the FROM clause? If so, do this:
>
> Select t.* FROM myTable t INNER JOIN
> (
> SELECT
> Field1, Field2, Field3
> FROM
> myTable
> GROUP BY
> Field1, Field2, Field3
> HAVING
> Count(*) > 1
> ) q
> ON t.Field1=q.Field1 AND t.Field2=q.Field2 AND t.Field3=q.Field3
>
> Please let us know upfront what database you are using so we don't waste> time and yours giving you irrelevant solutions.
>
> Bob Barrows
>
>
> atse wrote:>> > I am using MySQL. This doesn't work, which complains with
> > myTable.qfinddups doesn't exist.
> >
> >
> > "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
> > news:OrID4T9kDHA.2436@TK2MSFTNGP09.phx.gbl...> >> Is this Access? I suggest using Ken's SQL to create a saved query
> >> called qFindDups. Then create another query using this SQL:
> >>
> >> Select t.* FROM myTable t INNER JOIN qFindDups q
> >> ON t.Field1=q.Field1 AND t.Field2=q.Field2 AND t.Field3=q.Field3
> >>
> >> HTH,
> >> Bob Barrows
> >>
> >>
> >> "atse" <dunggaze@yahoo.com> wrote in message
> >> news:CBpjb.349225$Lnr1.181374@news01.bloor.is.net. cable.rogers.com...
> >>> This lists all the duplicates only with one of each. If the record
> >>> has more than one duplicate, it can't show all of them but one
> >>> only. Is there a way to show all? Thanks again.
> >>>
> >>> Atse
> >>>
> >>>
> >>> "Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
> >>> news:eOFYCytkDHA.3316@tk2msftngp13.phx.gbl...
> >>>> SELECT
> >>>> Field1, Field2, Field3
> >>>> FROM
> >>>> myTable
> >>>> GROUP BY
> >>>> Field1, Field2, Field3
> >>>> HAVING
> >>>> Count(*) > 1
> >>>>
> >>>> Cheers
> >>>> Ken
>
>
atse Guest
-
Ken Schaefer #9
Re: select all the duplicate records
[url]http://www.google.com.au/search?q=finding+duplicate+records+with+mySQL[/url]
Cheers
Ken
"atse" <dunggaze@yahoo.com> wrote in message
news:JPYjb.367003$Lnr1.53022@news01.bloor.is.net.c able.rogers.com...
: Sorry, I will complete my question next time.
: I guess MySQL may not support substring? Because it complains with that:
:
:
: Microsoft OLE DB Provider for ODBC Drivers error '80040e09'
:
: [MySQL][ODBC 3.51 Driver][mysqld-4.0.5-beta-max-nt]You have an error in
your
: SQL syntax. Check the manual that corresponds to your MySQL server version
: for the right syntax to use near 'SELECT f1, f3(
:
: /dp_record.asp, line 37
:
:
:
: Here is the line37 (please ignore the broken lines):
: ' file is myTable, and f1, f3 ... are the field names
:
: dataSQL = "select t.* FROM file t INNER JOIN (SELECT f1, f3, f5 FROM file
: GROUP BY f1, f3, f5 "
: dataSQL = dataSQL & "HAVING Count(*) > 1) q ON t.f1=q.f1 AND t.f3=q.f3 AND
: t.f5=q.f5"
:
:
:
: "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
: news:ukoS84JlDHA.2732@TK2MSFTNGP11.phx.gbl...
: > Does MySQL allow subqueries in the FROM clause? If so, do this:
: >
: > Select t.* FROM myTable t INNER JOIN
: > (
: > SELECT
: > Field1, Field2, Field3
: > FROM
: > myTable
: > GROUP BY
: > Field1, Field2, Field3
: > HAVING
: > Count(*) > 1
: > ) q
: > ON t.Field1=q.Field1 AND t.Field2=q.Field2 AND t.Field3=q.Field3
: >
: > Please let us know upfront what database you are using so we don't waste
: our
: > time and yours giving you irrelevant solutions.
: >
: > Bob Barrows
: >
: >
: > atse wrote:
: > > I am using MySQL. This doesn't work, which complains with
: > > myTable.qfinddups doesn't exist.
: > >
: > >
: > > "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
: > > news:OrID4T9kDHA.2436@TK2MSFTNGP09.phx.gbl...
: > >> Is this Access? I suggest using Ken's SQL to create a saved query
: > >> called qFindDups. Then create another query using this SQL:
: > >>
: > >> Select t.* FROM myTable t INNER JOIN qFindDups q
: > >> ON t.Field1=q.Field1 AND t.Field2=q.Field2 AND t.Field3=q.Field3
: > >>
: > >> HTH,
: > >> Bob Barrows
: > >>
: > >>
: > >> "atse" <dunggaze@yahoo.com> wrote in message
: > >> news:CBpjb.349225$Lnr1.181374@news01.bloor.is.net. cable.rogers.com...
: > >>> This lists all the duplicates only with one of each. If the record
: > >>> has more than one duplicate, it can't show all of them but one
: > >>> only. Is there a way to show all? Thanks again.
: > >>>
: > >>> Atse
: > >>>
: > >>>
: > >>> "Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
: > >>> news:eOFYCytkDHA.3316@tk2msftngp13.phx.gbl...
: > >>>> SELECT
: > >>>> Field1, Field2, Field3
: > >>>> FROM
: > >>>> myTable
: > >>>> GROUP BY
: > >>>> Field1, Field2, Field3
: > >>>> HAVING
: > >>>> Count(*) > 1
: > >>>>
: > >>>> Cheers
: > >>>> Ken
: >
: >
: >
:
:
Ken Schaefer Guest
-
atse #10
Re: select all the duplicate records
It seems there no effective way on that page. Did I miss one of them? Please
point out, Thanks
Atse
"Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
news:uabgnhTlDHA.2272@tk2msftngp13.phx.gbl...version> [url]http://www.google.com.au/search?q=finding+duplicate+records+with+mySQL[/url]
>
> Cheers
> Ken
>
> "atse" <dunggaze@yahoo.com> wrote in message
> news:JPYjb.367003$Lnr1.53022@news01.bloor.is.net.c able.rogers.com...
> : Sorry, I will complete my question next time.
> : I guess MySQL may not support substring? Because it complains with that:
> :
> :
> : Microsoft OLE DB Provider for ODBC Drivers error '80040e09'
> :
> : [MySQL][ODBC 3.51 Driver][mysqld-4.0.5-beta-max-nt]You have an error in
> your
> : SQL syntax. Check the manual that corresponds to your MySQL serverfile> : for the right syntax to use near 'SELECT f1, f3(
> :
> : /dp_record.asp, line 37
> :
> :
> :
> : Here is the line37 (please ignore the broken lines):
> : ' file is myTable, and f1, f3 ... are the field names
> :
> : dataSQL = "select t.* FROM file t INNER JOIN (SELECT f1, f3, f5 FROMAND> : GROUP BY f1, f3, f5 "
> : dataSQL = dataSQL & "HAVING Count(*) > 1) q ON t.f1=q.f1 AND t.f3=q.f3waste> : t.f5=q.f5"
> :
> :
> :
> : "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
> : news:ukoS84JlDHA.2732@TK2MSFTNGP11.phx.gbl...
> : > Does MySQL allow subqueries in the FROM clause? If so, do this:
> : >
> : > Select t.* FROM myTable t INNER JOIN
> : > (
> : > SELECT
> : > Field1, Field2, Field3
> : > FROM
> : > myTable
> : > GROUP BY
> : > Field1, Field2, Field3
> : > HAVING
> : > Count(*) > 1
> : > ) q
> : > ON t.Field1=q.Field1 AND t.Field2=q.Field2 AND t.Field3=q.Field3
> : >
> : > Please let us know upfront what database you are using so we don'tnews:CBpjb.349225$Lnr1.181374@news01.bloor.is.net. cable.rogers.com...> : our
> : > time and yours giving you irrelevant solutions.
> : >
> : > Bob Barrows
> : >
> : >
> : > atse wrote:
> : > > I am using MySQL. This doesn't work, which complains with
> : > > myTable.qfinddups doesn't exist.
> : > >
> : > >
> : > > "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
> : > > news:OrID4T9kDHA.2436@TK2MSFTNGP09.phx.gbl...
> : > >> Is this Access? I suggest using Ken's SQL to create a saved query
> : > >> called qFindDups. Then create another query using this SQL:
> : > >>
> : > >> Select t.* FROM myTable t INNER JOIN qFindDups q
> : > >> ON t.Field1=q.Field1 AND t.Field2=q.Field2 AND t.Field3=q.Field3
> : > >>
> : > >> HTH,
> : > >> Bob Barrows
> : > >>
> : > >>
> : > >> "atse" <dunggaze@yahoo.com> wrote in message
> : > >>> : > >>> This lists all the duplicates only with one of each. If the record
> : > >>> has more than one duplicate, it can't show all of them but one
> : > >>> only. Is there a way to show all? Thanks again.
> : > >>>
> : > >>> Atse
> : > >>>
> : > >>>
> : > >>> "Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
> : > >>> news:eOFYCytkDHA.3316@tk2msftngp13.phx.gbl...
> : > >>>> SELECT
> : > >>>> Field1, Field2, Field3
> : > >>>> FROM
> : > >>>> myTable
> : > >>>> GROUP BY
> : > >>>> Field1, Field2, Field3
> : > >>>> HAVING
> : > >>>> Count(*) > 1
> : > >>>>
> : > >>>> Cheers
> : > >>>> Ken
> : >
> : >
> : >
> :
> :
>
>
atse Guest



Reply With Quote

