搞定了 另外区间查询还可以支持更多的条件,只要是针对一个字段的条件都可以写到一起,例如:$map['name'] = array(array('like','%a%'), array('like','%b%'), array('like','%c%'), 'ThinkPHP','or'); 最后的查询条件是:(`name` LIKE '%a%') OR (`name` LIKE '%b%') OR (`name` LIKE '%c%') OR (`name` = 'ThinkPHP')…
前几天看别人的代码中看到在字段中使用select子查询的方法,第一次见这种写法,然后研究了一下,记录下来 大概的形式是这样的: select a .*,(select b.another_field from b where a.id=b.aid) another_field from a where 1 limit 10; 下面还是以实例来说明,要不然不好理解,新建两张表,一张是商品表,另外一张是商品的评论表 商品表: CREATE TABLE `product` ( `id` int(11)…