Limiting QMF Query Results

Rory M. McQuillan

Limiting QMF Query Results
>
>
> A common user request is for the top "n" accounts of a particular type.
> Is
> there an SQL "trick" or some other technique to set the result set size to
> a
> fixed number of rows?



Tim Lowe

Re: Limiting QMF Query Results
(in response to Rory M. McQuillan)
If you are using QMF version 3, release 3; then try:
run query (rowlimit=10)







"McQuillan, Rory M." <[login to unmask email]> on 12/22/99 09:10:11 AM

Please respond to DB2 Data Base Discussion List <[login to unmask email]>








To: [login to unmask email]

cc: (bcc: Tim Lowe/sfm/spc)



Subject: Limiting QMF Query Results








>
>
> A common user request is for the top "n" accounts of a particular type.
> Is
> there an SQL "trick" or some other technique to set the result set size to
> a
> fixed number of rows?








[login to unmask email]

Re: Limiting QMF Query Results
(in response to Tim Lowe)
This is the technique from the query which can give u the top n COL1 from
the table.

SELECT COL1,COL2,.........................
FROM T1 A
WHERE
N > (SELECT COUNT(*)
FROM T1 B
WHERE A.COL1 < B.COL1)


There is one more technique available in QMF i.e by QMF forms u can limit the no. of rows return and can get the top
"n" or last "n" values.

I hope it helps

Thanks

Sanjeev






"McQuillan, Rory M." <[login to unmask email]>@RYCI.COM> on 12/22/99
03:10:11 PM

Please respond to DB2 Data Base Discussion List <[login to unmask email]>

Sent by: DB2 Data Base Discussion List <[login to unmask email]>


To: [login to unmask email]
cc:
Subject: Limiting QMF Query Results


>
>
> A common user request is for the top "n" accounts of a particular type.
> Is
> there an SQL "trick" or some other technique to set the result set size
to
> a
> fixed number of rows?








[login to unmask email]

Re: Limiting QMF Query Results
(in response to ssethi@LOT.TATASTEEL.COM)
This is the technique from the query which can give u the top n COL1 from the table.

SELECT COL1,COL2,.........................
FROM T1 A
WHERE
N > (SELECT COUNT(*)
FROM T1 B
WHERE A.COL1 < B.COL1)

There is one more technique available in QMF i.e by QMF forms u can limit the no. of rows return and can get the top
"n" or last "n" values.






"McQuillan, Rory M." <[login to unmask email]>@RYCI.COM> on 12/22/99
03:10:11 PM

Please respond to DB2 Data Base Discussion List <[login to unmask email]>

Sent by: DB2 Data Base Discussion List <[login to unmask email]>


To: [login to unmask email]
cc:
Subject: Limiting QMF Query Results


>
>
> A common user request is for the top "n" accounts of a particular type.
> Is
> there an SQL "trick" or some other technique to set the result set size
to
> a
> fixed number of rows?