

sql查询
SELECT `user`.`email`,
`user`.`passwrd`,
`user`.`status`,
`useraccounts`.`Balance`,
`useraccounts`.`AccountID`, `accounts`.`AccountNo`,
wallet.Server_typ,wallet.DateBought,
wallet.LastDate,
wallet.Profit,
withdraws.walletAdrs,
withdraws.Amount,
withdraws.status AS WDStatus,
withdraws.message,
withdraws.Date
FROM `user`
LEFT JOIN `useraccounts` ON `user`.`email` = `useraccounts`.`email`
LEFT JOIN `accounts` ON `accounts`.`AccountID` = `useraccounts`.`AccountID`
LEFT JOIN wallet ON user.email = wallet.email
LEFT JOIN withdraws ON user.email = withdraws.email
WHERE user.type = 'user' 这是我的查询,它工作得很好,但是一个电子邮件地址有很多记录。正因为如此,我的电子邮件变得重复。每当我打电话到电子邮件时,就会出现重复的记录。我只想要一个预先的email.thanks
发布于 2019-11-20 23:05:23
SELECT DISTINCT `user`.`email`, `user`.`passwrd`, `user`.`status`,`useraccounts`.`Balance`, `useraccounts`.`AccountID`, `accounts`.`AccountNo`,wallet.Server_typ,wallet.DateBought,wallet.LastDate,wallet.Profit,withdraws.walletAdrs,withdraws.Amount,withdraws.status AS WDStatus, withdraws.message, withdraws.Date
FROM `user`
LEFT JOIN `useraccounts` ON `user`.`email` = `useraccounts`.`email`
LEFT JOIN `accounts` ON `accounts`.`AccountID` = `useraccounts`.`AccountID`
LEFT JOIN wallet ON user.email = wallet.email
LEFT JOIN withdraws ON user.email = withdraws.email
WHERE user.type = 'user'使用DISTINCT将只提供不同的记录。
https://stackoverflow.com/questions/58957363
复制相似问题