0

Hi All,

I have a list of entries from users and want mysql to only display entries that are unique.

The mysql statement is as follows

SELECT DISTINCT bids
FROM `tbl_bids`
ORDER BY `bids` ASC

On running the query it is still displaying items that appear more than once.

a table of data looks something like this

id user_id bids
1 1 0.1
2 1 0.2
3 1 0.3
4 2 0.1
5 2 0.2


Im wanting the output to show me, as seen in this table, the value of 0.3, but its listing everything.

Many thanks

Paul

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by vaultdweller123
0

That is not what distinct does. Distinct will show every value once. What you want is to output the bid that is only once in the table. Something like:

SELECT `bids` FROM `tbl_bids` GROUP BY `bids` HAVING COUNT(1) = 1 ORDER BY `bids` ASC
0

with your query, it's not just the 0.3 will be displayed, it will also display the 0.1 and 0.2

your recordset will look something like this

0.1
0.2
0.3

Edited by vaultdweller123: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.