我有一个名为"注册"
的MYSQL表id license price attachment_id (maps back to the same table)
33 Description A 10 35
34 Description B 15 0
35 Description C 18 0
36 Description D 5 37
37 Description E 10 0
我需要获取id = 33的行并输出 ANOTHER ROW ,其中 attachment_id 列与" id & #34;同一列中的列。
所以,输出应该是:
id license price attachment_id (maps back to the same table)
33 Description A 10 35
35 Description C 18 0
如果没有UNION,我怎么能这样做?
答案 0 :(得分:1)
可能的:
select * from registrations where
id = 33 or id = (select attachment_id from resgistrations where id = 33)