id name age times
1 ayiosi 21 1
1 ayiosi 21 2
1 ayiosi 21 3
...... ----------------------------------------------
我的问题是 查出times为最大的记录,不可以使用 select * from table where times=3
1 ayiosi 21 1
1 ayiosi 21 2
1 ayiosi 21 3
...... ----------------------------------------------
我的问题是 查出times为最大的记录,不可以使用 select * from table where times=3
from tb t
where not exists(select 1 from tb where times>t.times)--或者
select *
from tb
where times=(select max(times) from tb)--或者
select *
from tb
where times=(select top 1 times from tb order by times desc)
select L_loan_info.loan_id as loan_id,L_loan_info.defer_type,L_loan_info.loan_apply_money as money, L_person_info.
person_name as custname,L_extd_apply.cont_collect_date as date, L_loan_info.loan_no as no, E_emp_info.emp_name as empname
, L_loan_info.sett_money as outmoney,L_loan_biz.loan_biz_name as biz ,L_loan_info.loan_base_rate as rate from L_loan_info
inner join L_person_info on L_loan_info.loan_cust_id=L_person_info.person_info_id
inner join L_loan_biz on L_loan_biz.loan_biz_id=L_loan_info.loan_biz_class_id
inner join E_emp_info on E_emp_info.emp_id=L_loan_info.cust_mgr_id
inner join L_extd_apply on L_loan_info.loan_id=L_extd_apply.loan_id
查出来的是两条一样的记录,但times不一样,可我只要一条语句,像你那样其他的都查不出来了。