开发者

Union query in mysql [closed]

开发者 https://www.devze.com 2022-12-08 23:03 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. 开发者_开发技巧
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 8 years ago.

Improve this question

I have 2 tables catelog and catelog copy. And, I need to to display both these table fields as one table using mysql.

Can anyone correct this code for joining 2 tables?

$result = mysql_query("SELECT * FROM catelog WHERE title='".$fileid."'union
select status  from catelog_copy " );


SELECT statements you'd like to UNION have to return the same number of columns and types of those columns should match.

So

SELECT a, b, c FROM table1 UNION SELECT a, b, c FROM table2

will work, but

SELECT a, b FROM table1 UNION SELECT a, b, c FROM table2

will not.

Names of the fields and the fields themselves might be different though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号