Mysql - 有没有更好的方法从两个具有相同ID的表中检索数据?

时间:2022-09-11 01:08:01

Hi I have the following Mysql code that works but I was wondering if there was a better, shorter, more efficient way of doing it?

嗨,我有以下可用的Mysql代码,但我想知道是否有更好,更短,更有效的方法吗?

select
images.*,
posts.*
from
mjbox_images AS images,
mjbox_posts AS posts
where
images.post_id = 3 AND posts.post_id = 3

1 个解决方案

#1


3  

SELECT * FROM mjbox_images JOIN mjbox_posts USING (post_id) WHERE post_id = 3

#1


3  

SELECT * FROM mjbox_images JOIN mjbox_posts USING (post_id) WHERE post_id = 3