|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Distinct record question
Hi there,
I'm very new in SQL... and really appreciate your help on this. I've a table structure & records as below, PDATE | ID | POINTS 2008/01/31 | 12345 | 100 2008/02/12 | 12345 | 1000 2008/02/12 | 12345 | 1000 2008/02/12 | 23456 | 500 I want to extract the data which the 'PDATE' is yesterday... assume today is 2008/02/13. I've a scripts running fine as below, SELECT A.Pdate , A.ID, A.Point FROM TABLE_A WHERE Pdate between (current_date-1) and (current_date+1) ORDER BY A.Pdate DESC However, I also want it to show 1 record per ID. With the scripts above, I'm having 1 extra record. How should I change to scripts? 2008/02/12 | 12345 | 1000 <- This should not appears 2008/02/12 | 12345 | 1000 2008/02/12 | 23456 | 500 Thanks! |
|
#2
|
||||
|
||||
|
Don't you think you shouldn't have duplicate records anyway?
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) Understanding SQL Joins An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries |
|
#3
|
|||
|
|||
|
Yes, that should be... therefore I would like to export out the correct information only , with the Distinct statement...
how can i do it? Many thanks! |
|
#4
|
||||
|
||||
|
Quote:
|
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Distinct record question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|