SERIAL_NUMBER WEPKEY SSID PASSWORD SBBS I_TIME
0C4C397581CB apjkzhcp 4KYP vnnhx 350000C4C39758199 2011/10/26 20:10:14
0C4C397581CB uwjngn62 YfDw gmeag 340000C4C397581CB 2011/10/26 20:20:14像上面的表 :sajet.iac_oem我想查出最新一笔的资料我的SQl是这样的,但是不知道为什么会报:ora-00913 :too many valuesselect b.wepkey, b.ssid, b.password, b.sbbs
from sajet.iac_oem b
where b.serial_number in (select SERIAL_NUMBER,
max(to_char(i_time, 'YYYY/MM/DD HH24:MI:SS')) i_time
from sajet.iac_oem t
group by SERIAL_NUMBER)请高手帮忙,该怎么修改。谢谢
0C4C397581CB apjkzhcp 4KYP vnnhx 350000C4C39758199 2011/10/26 20:10:14
0C4C397581CB uwjngn62 YfDw gmeag 340000C4C397581CB 2011/10/26 20:20:14像上面的表 :sajet.iac_oem我想查出最新一笔的资料我的SQl是这样的,但是不知道为什么会报:ora-00913 :too many valuesselect b.wepkey, b.ssid, b.password, b.sbbs
from sajet.iac_oem b
where b.serial_number in (select SERIAL_NUMBER,
max(to_char(i_time, 'YYYY/MM/DD HH24:MI:SS')) i_time
from sajet.iac_oem t
group by SERIAL_NUMBER)请高手帮忙,该怎么修改。谢谢
1对多了。
select * from (
select wepkey, ssid, password, sbbs
from sajet.iac_oem
order by i_time desc) where rownum=1
排序取第一个值就是最新的了
或者按你的写法,但要修改一下select b.wepkey, b.ssid, b.password, b.sbbs
from sajet.iac_oem b
where b.serial_number,[color=#FF0000]b.i_time [/color]in (select SERIAL_NUMBER,max(i_time) i_time from sajet.iac_oem t
group by SERIAL_NUMBER)
from sajet.iac_oem b
where b.serial_number in (select SERIAL_NUMBER from sajet.iac_oem t
group by SERIAL_NUMBER)
from sajet.iac_oem b
ORDER BY b.I_TIME) t
GROUP BY t.wepkey,t.sword, t.sbbs
FROM (SELECT DISTINCT (B.WEPKEY), SWORD, B.SBBS
FROM SAJET.IAC_OEM B
ORDER BY B.I_TIME) T
WHERE ROWNUM <=1
GROUP BY T.WEPKEY,
T.SWORD,
T.SBBS
from sajet.iac_oem b
where b.serial_number,ROWID in (select SERIAL_NUMBER,MIN(ROWID) from sajet.iac_oem t
group by SERIAL_NUMBER)
select b.wepkey, b.ssid, b.password, b.sbbs
from sajet.iac_oem b
where (b.serial_number,ROWID) in (select SERIAL_NUMBER,MIN(ROWID) from sajet.iac_oem t
group by SERIAL_NUMBER)
max(to_char(i_time, 'YYYY/MM/DD HH24:MI:SS')) i_time
from sajet.iac_oem t
group by SERIAL_NUMBER)select SERIAL_NUMBER,max(to_char(i_time, 'YYYY/MM/DD HH24:MI:SS')) i_time查出来是两列
b.serial_number in 是一列
改成:
where (b.serial_numbe,b.i_time) in (select SERIAL_NUMBER,
max(to_char(i_time, 'YYYY/MM/DD HH24:MI:SS')) i_time
from sajet.iac_oem t
group by SERIAL_NUMBER)