我想运行一个查询,它返回包含A或B的所有结果,但它只返回列出的第一个结果。当我单独运行时,我可以从A获得结果,从B获得结果,但是不能使用OR语句。
dbGetQuery(db, "SELECT winery, Name, year, Price FROM Wines
WHERE price <= 10
AND name LIKE '%Chardonnay%' OR '%Riesling%'
ORDER BY price ASC
LIMIT 10")
只返回Chardonnay
Winery Name Year price
1 Pine & Post Chardonnay 2004 5
2 Two Vines Chardonnay 2013 6
3 Pine & Post Chardonnay 2006 6
4 Pine & Post Chardonnay 2005 6
5 Columbia Crest Semillon-Chardonnay 2000 6
6 Pine & Post Chardonnay 2010 7
7 Pine & Post Chardonnay 2008 7
8 Washington Hills Chardonnay 2006 7
9 Covey Run Semillon-Chardonnay 2002 7
10 Covey Run Semillon-Chardonnay 2000 7
我已经确认,如果查询工作正常,至少会有3个雷司令包含在内