[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] question on rownum



the rownum line wont work, i'm pretty sure.  the 'and rownum < 2' is oracle
syntax, and sqr is database independant.  so the solution you should use is

Begin-SELECT loops=1
lvl.DeptId
lvl.DM_Dept_Lvl
FROM PS_dept-tbl lvl
WHERE effdt = (Select Max(Effdt) from PS_Dept_tbl lvl2 where lvl2.deptid
=lvl.deptid and effdt<= Sysdate)
AND lvl.DM_dept_lvl < = '11'
End-Select

...but make sure that you do an ORDER BY to grab the one you want, or be
sure that there's only one row.  



-----Original Message-----
From: sqr-users-bounces+bstone=fastenal.com@sqrug.org
[mailto:sqr-users-bounces+bstone=fastenal.com@sqrug.org]On Behalf Of
subrahmanyam Uppuganti
Sent: Wednesday, August 18, 2004 1:25 PM
To: sqr-users@sqrug.org
Subject: [sqr-users] question on rownum


Hi all,
Does the following syntax work in sqr..else can some suggest me an
alternative, I need to get only the first row
Thanks
subbu
 
Begin-Select
lvl.DeptId
lvl.DM_Dept_Lvl
>From PS_dept-tbl lvl
where effdt = (Select Max(Effdt) from PS_Dept_tbl lvl2 where lvl2.deptid
=lvl.deptid and effdt<= Sysdate)
and lvl.DM_dept_lvl < = '11'
and rownum = 1  <-----???????????
End-Select
 
 

                
---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users