SQL use DISTINCT with ORDER BY (Oracle)
        Posted  
        
            by ArneRie
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ArneRie
        
        
        
        Published on 2010-03-08T11:50:02Z
        Indexed on 
            2010/03/08
            11:51 UTC
        
        
        Read the original article
        Hit count: 259
        
Hi,
i have an strange problem. I want to select "timestamps" from an DB Table with Distinct and orderded by timestamp.
ID     TimeStamp
--     ---------
1      123456789
2      123456789
3      333333333
4      334345643
In my PHP Script:
$sql = "SELECT DISTINCT TIMESTAMP FROM TIMESTAMPS ORDER BY TIMESTAMP"
When i use order by, the values are returned twice? Without order by the result is correct.. but not sorted.
We are using Oracle 10g
Any ideaS?
© Stack Overflow or respective owner