这是我的疑问:
SELECT m_title `title` from members UNION select n_title `title` FROM news
虽然下一个查询成功,但是这个sql查询失败没有明显的原因:
SELECT id from members UNION select n_id `title` FROM news
可能是什么问题?
成员:
id int(11) No None AUTO_INCREMENT Change Drop More
2 member_id int(150) No None Change Drop More
3 m_title varchar(200) utf8_unicode_ci Yes NULL Change Drop More
4 txtshortdetails text utf8_unicode_ci No None Change Drop More
5 txtfulldetails text utf8_unicode_ci No None Change Drop More
6 video_src varchar(200) utf8_unicode_ci No None Change Drop More
7 m_order int(11) No None Change Drop More
8 m_cat int(11) No None Change Drop More
9 m_date datetime No None Change Drop More
10 m_change_date date No None Change Drop More
新闻:
n_id int(10) No None AUTO_INCREMENT Change Drop More
2 n_title varchar(200) utf8_general_ci Yes NULL Change Drop More
3 n_details text utf8_general_ci Yes NULL Change Drop More
4 n_pic varchar(200) utf8_general_ci Yes NULL Change Drop More
5 n_order int(11) No None Change Drop More
6 n_date date Yes NULL Change Drop More
答案 0 :(得分:0)
AS
关键字:如果我错了,请纠正我。
SELECT `m_title` AS `title` FROM `members`
UNION
SELECT `n_title` AS `title` FROM `news`
并确保相应表格中存在m_title
和n_title
列。
答案 1 :(得分:0)
谢谢大家的帮助。
问题出在2列的不同排序中
第一个:“utf8_general_ci”
第二个是:“utf8_unicode_ci”
我把它们做成了相同的