帮忙写这个SQL查询语句
有这么一个表:
id | name | age | item
1 | tom | 12 | 1
2 | cat | 23 | 2
3 | ... | 36 | 3
4 | ... | 15 | 4
5 | ... | 26 | 2
6 | ... | 16 | 1
.......
找出 item=3的age 且 其他age小于item=3的age
找出 item=3的age 且 其他age小于item=3的age
很好,很强大的要求,一个字都没看懂!
看完我就迷糊了,哈哈哈,果子,看完你回的,我实在忍不住,这要求笑死我了~~
咬文嚼字半天~~,楼主是不是要把item <=3的age查出来呀??
select * from 表名 where item=3 and age <ALL(select age from 表名 where item=3);
...楼主意思是不是 找出item=3的 age最小的那条数据?
先取出item=3 再按年龄升序 取第一条
比较难懂
select age from 这个表名 where item <=3;
你的表达能力实在不是一般..不过我非常人...
4楼说的是不是这样可以实现
select top 1 * from 表名 where item=3 group by
相关问答:
两种错误:
1.如果我这样申明:ResultSet rs;错误提示如下:
An error occurred at line: 51 in the jsp file: /index.jsp
The local variable rs may not have been initialized
48: ......
我EXCEL中一个单元格的数据如 "2009-01","8949-232"
将这个数据粘贴到PL/SQL中的一个表中后,数据确是成为了 2009-01,8949-232 ,把所有的""都没了,
如何弄呢?请大家试 ......
sql2005
select *from v_ddxx where d_sfsc='0' and (g_ssbm='1001' or g_ssbm='1002') and (xxf>0 and xxfwzf <>0 ),执行速度慢的要死,但是如果把(xxf>0 and ......
我的语句为str1.Format("UPDATE wz set title='%s',class='%s',nr='%s',[date]='%s' WHERE num='%d'",
m_bt, strTemp, fromClipboard, time5,m_num);
......
下面的日期我要用变量表示
但我接收的日期的格式与下面不同
我接收的如 2009-10-10
我应该怎么变呢?
每次都把 date1 和date2用String 这样是不是不好
SQL code:
between '" ......