Questions tagged «sql»

1
如何使用查询对象在WHERE子句中组合AND和OR?
给定以下所需的SQL,必须满足Cond1 和 Cond2 或必须满足Cond3的选择,才可以使用正确的方法getQuery()来实现? 所需的SQL: 括号中的Condition1和Condition2) SELECT * FROM #__myTable WHERE (condition1=true AND condition2=true) OR condition3=true 使用链接: 在-> where()中指定OR $query = $db->getQuery(true); $query->select('* FROM #__myTable') ->where('condition1 = true AND condition2 = true','OR') ->where('condition3 = true'); 结果SQL:(SQL缺少括号) SELECT * FROM scm_myTable WHERE condition1 = true AND condition2 = true OR condition3 …
21 jdatabase  sql 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.