sql 多条件查询语句并且能选择最后一条记录

2025-05-12 19:20:27
推荐回答(5个)
回答(1):

select top 1 from table where (字段1=A1) and (字段2=B2) and (字段3=C3) and (字段4=D5) order by id desc

回答(2):

select top 1 from table123 where column1 in ('A1','B2','C3','D5') order by 自动编号 desc

试试看!

回答(3):

这种指定第几条的选择,由于没有字段名作为排序条件,一般要用游标的。

回答(4):

;)
order
by
自动编号
desc
试试看select
top
1
from
table123
where
column1
in
('D5',','B2','C3'A1'

回答(5):

select top(1) * from table where (字段1=A1) and (字段2=B2) and (字段3=C3) and (字段4=D5) order by id desc