首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SQL数据复制

SQL数据复制
EN

Stack Overflow用户
提问于 2019-11-20 23:00:29
回答 1查看 42关注 0票数 0

sql查询

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-11-20 23:05:23

代码语言:javascript
复制
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将只提供不同的记录。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58957363

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档