![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a database being populated by hits to a program on a server. The problem is each client connection may require a few hits in a 1-2 second time frame. This is resulting in multiple database entries - all exactly the same, except the event_id field, which is auto-numbered. I need a way to query the record w/out duplicates. That is, any records exactly the same except event_id should only return one record. Is this possible?? Thank you, Barry |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
hrm....no luck. I ran this: SELECT * from `playback_log` a,(SELECT min(EVENT_ID) FROM `playback_log` ) AS b WHERE a.EVENT_ID = b.EVENT_ID Can you see anything? I appreciate the help a bunch. thank you |
#5
| |||
| |||
|
|
SELECT * FROM playback_log a WHERE a.event_id = (select min(event_id) from playback_log b where a.field1 = b.field1) |
#6
| |||
| |||
|
|
"Thomas Kellerer" <WVIJEVPANEHT (AT) spammotel (DOT) com> wrote in message news:46petmFc69qnU1 (AT) individual (DOT) net... SELECT * FROM playback_log a WHERE a.event_id = (select min(event_id) from playback_log b where a.field1 = b.field1) Here's a similar possibility, without using a correlated subquery: SELECT a.* FROM playback_log AS a WHERE a.event_id IN ( SELECT MIN(b.event_id) FROM playpack_log AS b GROUP BY b.field1, b.field2, b.field3, ...) What I've seen missing in the several solutions proposed is any use of GROUP BY. You'll need to GROUP BY all the fields of the table _except_ for event_id. |
#7
| |||
| |||
|
|
From LoginTable |
|
From LoginTable Group by blah1, blah2, [all fields except event_id], blah99 |
|
From LoginTable Group by blah1, blah2, [all fields except event_id], blah99 |
#8
| |||
| |||
|
|
I have a database being populated by hits to a program on a server. The problem is each client connection may require a few hits in a 1-2 second time frame. This is resulting in multiple database entries - all exactly the same, except the event_id field, which is auto-numbered. I need a way to query the record w/out duplicates. That is, any records exactly the same except event_id should only return one record. Is this possible?? Thank you, Barry |
#9
| |||
| |||
|
|
(but the ID field is still a poor crutch for a possibly weak design.) |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |