gpt4 book ai didi

mysql - 如何查看mysql中多个表的所有数据

转载 作者:行者123 更新时间:2023-11-30 01:13:18 24 4
gpt4 key购买 nike

我从两个表中选择数据;

mysql> select rq_grcode, mo_date from mg_log where rq_grcode like 'AM%' and mo_date like '2010-05%' group by rq_grcode order by rq_grcode asc;
+-----------+------------+
| rq_grcode | mo_date |
+-----------+------------+
| AM0001 | 2010-05-20 |
| AM0029 | 2010-05-20 |
| AM0035 | 2010-05-20 |
+-----------+------------+
3 rows in set (0.00 sec)

mysql> select a.grcode, a.cpid, b.mo_date from mg_content a, mg_log b where a.grcode like 'AM%' and b.mo_date like '2010-05%' group by a.grcode order by a.grcode asc;
+--------+------+------------+
| grcode | cpid | mo_date |
+--------+------+------------+
| AM0013 | CP02 | 2010-05-17 |
| AM0014 | CP02 | 2010-05-17 |
| AM0015 | CP02 | 2010-05-17 |
| AM0017 | CP02 | 2010-05-17 |
| AM0018 | CP02 | 2010-05-17 |
| AM0019 | CP02 | 2010-05-17 |
| AM0020 | CP02 | 2010-05-17 |
| AM0021 | CP02 | 2010-05-17 |
| AM0022 | CP02 | 2010-05-17 |
| AM0023 | CP02 | 2010-05-17 |
| AM0024 | CP02 | 2010-05-17 |
| AM0025 | CP02 | 2010-05-17 |
| AM0026 | CP02 | 2010-05-17 |
| AM0027 | CP02 | 2010-05-17 |
| AM0028 | CP02 | 2010-05-17 |
| AM0029 | CP02 | 2010-05-17 |
| AM0030 | CP02 | 2010-05-17 |
| AM0031 | CP02 | 2010-05-17 |
| AM0032 | CP02 | 2010-05-17 |
| AM0033 | CP02 | 2010-05-17 |
| AM0034 | CP02 | 2010-05-17 |
| AM0035 | CP02 | 2010-05-17 |
| AM0036 | CP02 | 2010-05-17 |
| AM0037 | CP02 | 2010-05-17 |
| AM0038 | CP02 | 2010-05-17 |
| AM0039 | CP02 | 2010-05-17 |
| AM0040 | CP02 | 2010-05-17 |
| AM0041 | CP02 | 2010-05-17 |
| AM0042 | CP02 | 2010-05-17 |
| AM0043 | CP02 | 2010-05-17 |
| AM0044 | CP02 | 2010-05-17 |
| AM0045 | CP02 | 2010-05-17 |
| AM0046 | CP02 | 2010-05-17 |
| AM0047 | CP02 | 2010-05-17 |
| AM0048 | CP02 | 2010-05-17 |
+--------+------+------------+
35 rows in set (0.01 sec)

如何显示 grcode 和 rq_grcode 列中的所有数据?我不是 mysql 专家,所以我真的需要答案。 tQ

最佳答案

select a.*, b.* from mg_content a, mg_log b 
where a.grcode like 'AM%' and b.mo_date like '2010-05%'
group by a.grcode
order by a.grcode asc;

关于mysql - 如何查看mysql中多个表的所有数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19291176/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com