怎样列出两种查询方式下结果不同的情况?
要查询数据库中出现异常的数据,因为两种查询方式查询出来的结果有可能不一样.
查询某客户最大编号的一张发票的id,第一种查询方法
select top 1 id from purchase_customer_balance where right(invoice_no,5) = '-' + datename(yy,getdate()) and customer_code='135' order by cast(parsename(replace(invoice_no , '-' , '.'),2) as int) desc
select top 1 id from purchase_customer_balance where customer_code='135' order by id desc
select top 1 id from purchase_customer_balance where right(invoice_no,5) = '-' + datename(yy,getdate()) and customer_code='135' order by cast(parsename(replace(invoice_no , '-' , '.'),2) as int) desc select top 1 id from purchase_customer_balance where customer_code='135'order by id desc