select * from tabela a where not exists (select 1 from tablea where [money]>a.[money])
不可以 select * from tabel where money in (select max(money) from table)
可以告诉我,select * from tabel a where [money]>a.[money] 这样为什么不行么
显然是不行的呀 在a.money 是个不确定的值怎么比较呀
select * from tabela a where not exists (select 1 from tablea where [money]>a.[money])那这如何解释???
我认为你那样写,在语法上是没有问题的。 但事实上是没有道理的。 因为在一个表中,不可能某字段同自身比较的。没有意义,也不能出现结果。你想一想是不是这样。 你想要找到某字段的最大值记录,可以向冰点写的那样做: select * from table where money in (select max(money) from table)
可以告诉我,select * from tabel a where [money]>a.[money] 这样为什么不行么 這樣做會選出所有大於a.[money]的所有[money]。即大於a.[money]中最小的就會選出來。 select * from tabela a where not exists (select 1 from tablea where [money]>a.[money])那这如何解释??? 這個意思是當沒有一個[money]的值>a.[money]時選出記錄。即a.[money]為最大的時候。
select * from tabel where money in (select max(money) from table)
这样为什么不行么
在a.money 是个不确定的值怎么比较呀
但事实上是没有道理的。
因为在一个表中,不可能某字段同自身比较的。没有意义,也不能出现结果。你想一想是不是这样。
你想要找到某字段的最大值记录,可以向冰点写的那样做:
select * from table where money in (select max(money) from table)
这样为什么不行么
這樣做會選出所有大於a.[money]的所有[money]。即大於a.[money]中最小的就會選出來。
select * from tabela a where not exists (select 1 from tablea where [money]>a.[money])那这如何解释???
這個意思是當沒有一個[money]的值>a.[money]時選出記錄。即a.[money]為最大的時候。