select c.co_id, c.companyname, c.companytype, c.province, c.city, 
       j.cartype_id, j.etprice, n.info_id, n.cuxiao_topic
from tbl_jxs_car j
join tbl_company_list c on c.co_id=j.jxs_id
join tbl_car_info i on i.cartype_id=j.cartype_id
left join newtable n on c.co_id=n.jxs_id
where i.isdelete=0 and c.is_delete=0 and j.etprice<>'0' and j.etprice<>'' 
order by j.dateandtime desc

解决方案 »

  1.   

    谢谢,对了,不过我忘了一点说明 newtable有多条记录.我要最新的一条记录.也就是n.info_id是最大的
      

  2.   

    把newtable换成下面试试看效果select jxs_id,info_id, cuxiao_topic
    from newtable 
    where info_id in (select max(info_id)
                      from newtable
                      group by jxs_id)
      

  3.   

    ...
    left join (select jxs_id,info_id, cuxiao_topic
    from newtable 
    where info_id in (select max(info_id)
                      from newtable
                      group by jxs_id)) n on c.co_id=n.jxs_id
    ...