知道 了 SELECT 表1.nmae, 表1.xuehao, 表2.id FROM 表1 INNER JOIN 表2 ON 表1.xuehao=表2.xuehao;
(select distinct c.title from cate c join posts p on c.id=p.fup order by c.id) union all (select distinct c.title from cate c left join posts p on c.id=p.fup where p.title is NULL order by c.id) ;
回复 loveflea(coolwind) Parse error: parse error, unexpected T_STRING in D:\www\ourtour\iline\index.php on line 30cate 表 qfdid = posts qfdid //真实 cate 表 id = posts fup //为了说明清楚些就用这个替代了$query=mysql_query("select distinct c.title,c.qfdid from cate c left join posts p on c.qfdid=p.qfdid order by c.id")union all("select distinct c.title from cate c left join posts p on c.qfdid=p.qfdid where p.title is NULL order by c.id");
这个是你的问题,php字符串的问题$query=mysql_query("(select distinct c.title from cate c join posts p on c.id=p.fup order by c.id) union all (select distinct c.title from cate c left join posts p on c.id=p.fup where p.title is NULL order by c.id)");
SELECT 表1.nmae, 表1.xuehao, 表2.id
FROM 表1 INNER JOIN 表2 ON 表1.xuehao=表2.xuehao;
union all
(select distinct c.title from cate c left join posts p on c.id=p.fup where p.title is NULL order by c.id)
;
cate 表 id = posts fup //为了说明清楚些就用这个替代了$query=mysql_query("select distinct c.title,c.qfdid from cate c left join posts p on c.qfdid=p.qfdid order by c.id")union all("select distinct c.title from cate c left join posts p on c.qfdid=p.qfdid where p.title is NULL order by c.id");