TP的一条sql语句(子查询)


$model=M('');
$model->table(C('DB_PREFIX').'goods as g')
      ->join(C('DB_PREFIX').'orders as o on o.goods_id=g.id')
      ->where('o.user_id='.$userid.' and o.state=1 and o.id not in(select c.order_id from '.C('DB_PREFIX').'comment as c where c.user_id='.$userid.' and c.goods_id=g.id )')

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM