Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- I can't see the wood for the trees.


Matthew1980 - 9:36 pm on Feb 15, 2011 (gmt 0)


Hello people,

SELECT DISTINCT `FaultType`, `ID` FROM `faultdatabase`

This isn't working as I expect, I shouldn't get duplicates from the FaultType column, and I would have expected the corresponding/associated id numbers to have been returned too, but I get:

(faulttype|id)

Short circuit 41
No power 40
Short circuit 42
No power 43

Whereas I would have expected this:-

(faulttype|id)
Short circuit 41
No power 40

As I would expect the lower numbers (first rows) to have taken precedence..

This will probably make sense tomorrow, but I just thought as I ought to seek advice.

Cheers,
MRb


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4267598.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com