Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this questionI 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.
精彩评论