Mysql PHP 不显示重复的 id

Mysql PHP do not show duplicate id

我想从此查询中删除重复的用户名:

SELECT
    transactions.id,
    transactions.user_id,
    transactions.dikaioma,
    transactions.`in`,
    users.`name` AS username,
    users.score,
    users.startDikaioma,
    transactions.`out`,
    games.`name`,
    banks.bank_id,
    banks.sxolio
FROM
    transactions
INNER JOIN 
    users ON transactions.user_id = users.id
INNER JOIN 
    games ON users.curgame = games.id
INNER JOIN 
    posta ON users.posto_id = posta.posto_id
INNER JOIN 
    banks ON posta.posto_bank_id = banks.bank_id
WHERE
    transactions.`in` NOT BETWEEN 0 AND 1
ORDER BY
    transactions.id DESC
LIMIT 10

有人可以帮助我如何 不显示来自用户的重复 ID 我尝试

GROUP BY users.id HAVING count(users.id) > 1) 

但不起作用..错误

尝试在 SELECT 之后添加 DISTINCT。那应该省略任何重复项。

http://www.tutorialspoint.com/sql/sql-distinct-keyword.htm

您是否尝试过在不希望重复的列上使用 DISTINCT 函数。

SELECT DISTINCT
transactions.id,
transactions.user_id,
transactions.dikaioma,
transactions.`in`,
users.`name` AS username,
users.score,
users.startDikaioma,
transactions.`out`,
games.`name`,
banks.bank_id,
banks.sxolio
FROM
transactions
INNER JOIN users ON transactions.user_id = users.id
INNER JOIN games ON users.curgame = games.id
INNER JOIN posta ON users.posto_id = posta.posto_id
INNER JOIN banks ON posta.posto_bank_id = banks.bank_id
WHERE
transactions.`in` NOT BETWEEN 0 AND 1
ORDER BY
transactions.id DESC
LIMIT 10