> hi, i'm trying to select * through 3 tables - is the following syntax
correct?
>
> $sql="(SELECT * FROM mjp_cc)";
> $sql="UNION";
> $sql="(SELECT * FROM imc_cc)";
> $sql="UNION";
> $sql="(SELECT * FROM pmp_cc)";
> $sql.=" ORDER BY savedccactivity DESC";
>
> i basically just want to spit out the contents of these tables...
>
> also - how would this type of query work if the name 'savedccactivity' is
> different in all 3
> tables?

This is a MySQL question, first of all.

Second, you need to rename the column in each table to 'savedccactivity' if
you want to order the whole result by that.

(SELECT foo AS column FROM table1)
UNION
(SELECT bar AS column FROM table2)
UNION
(SELECT abc AS column FROM table3)
ORDER BY column DESC

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to