作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
$query = "SELECT GROUP_CONCAT( luckydraw_weekone.Email),
GROUP_CONCAT(luckydraw_weektwo.Email),
GROUP_CONCAT(participants.Email)
FROM luckydraw_weekone
LEFT JOIN luckydraw_weektwo
ON luckydraw_weekone.id = luckydraw_weektwo.id
LEFT JOIN participants ON luckydraw_weekone.id = participants.id";
$qry_result = mysql_query($query) or die(mysql_error());
$display_string = "<table border=\"1\">";
$display_string = "<table border=\"1\">";
$display_string .= "<tr>";
$display_string .= "</tr>";
while($row = mysql_fetch_array($qry_result)){
$display_string .= "<tr>";
$display_string .= "<td>$row[0]</td>";
$display_string .= "<td>$row[1]</td>";
$display_string .= "<td>$row[2]</td>";
$display_string .= "</tr>";
$query2 = "SELECT * FROM users WHERE mail='.$row[0].' OR mail='.$row[1].' OR mail='.$row[2].'";
$qry_result2 = mysql_query($query2) or die(mysql_error());
$display_string_user = "<table border=\"1\">";
while($row2 = mysql_fetch_array($qry_result2)){
$display_string_user .= "<tr>";
$display_string_user .= "<td>$row[0]</td>";
$display_string_user .= "<td>$row[1]</td>";
// and all details you want to add
$display_string_user .= "</tr>";
}
}
$display_string .= "</table>";
$display_string_user .= "</table>";
echo $display_string;
echo $display_string_user;
最佳答案
试试这个:
SELECT DISTINCT u.mail
FROM users u
INNER JOIN (SELECT email FROM luckydraw_weekone
UNION
SELECT email FROM luckydraw_weektwo
UNION
SELECT email FROM participants
) AS A ON u.mail = A.email
关于mysql - 通过合并名为 luckydraw_weekone、luckydraw_weektwo 的三个表来显示用户表中现有的电子邮件,所有参与者的字段都为电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21018396/
$query = "SELECT GROUP_CONCAT( luckydraw_weekone.Email), GROUP_CONCAT(luckydraw_weektwo.Em
我是一名优秀的程序员,十分优秀!