MySQL选择某些变量

问题描述 投票:-2回答:1

我对MySQL很新,我目前只想显示变量“活动”等于多个条目的数据:壁画,音乐会,剧院和博物馆。我该怎么做?

SELECT * FROM trail101 ORDER BY id DESC LIMIT 0, 9

php mysql database
1个回答
3
投票

你需要使用WHERE条款。漫长的道路:

SELECT * FROM trail101 WHERE
    activities = 'murals' OR
    activities = 'concert' OR
    activities = 'theater' OR
    activities = 'museums'
    ORDER BY id DESC LIMIT 0, 9

或者与IN

SELECT * FROM trail101
    WHERE activities IN('murals', 'concert', 'theater', 'museums')
    ORDER BY id DESC LIMIT 0, 9
© www.soinside.com 2019 - 2024. All rights reserved.