从多个表中选择并在mysql中搜索。帮帮我

问题描述 投票:0回答:1

enter image description here> sql = 'SELECT news., news_archive. FROM news,news_archive WHERE news.headline LIKE :keyword AND news_archive.headline LIKE :keyword ORDER BY news.date AND news_archive.date DESC';

sql = 'SELECT news.*, news_archive.* FROM news,news_archive WHERE news.headline LIKE :keyword AND news_archive.headline LIKE :keyword ORDER BY news.date AND news_archive.date DESC';

但重复上市消息?请帮助我。

enter image description here

有2个表,news和archive news。 我想在 2 个表中搜索新闻标题 两个表有一个新闻标题列。

SELECT table1.*,table2.* FROM table1,table2 WHERE tabel1.colon1 LIKE %search% AND tabel2.colon2 LIKE %search% ORDER BY tabel2.date AND tabel2.date DESC

enter image description here enter image description here

select multiple-tables
1个回答
0
投票

sql = 'SELECT news.news_title_column, news_archive.news_title_column FROM news,news_archive WHERE news.headline LIKE :keyword AND news_archive.headline LIKE :keyword ORDER BY news.date AND news_archive.date DESC';

© www.soinside.com 2019 - 2024. All rights reserved.