Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Sequential numbers in a query


Message #1 by "Enzo Zaragoza" <enzaux@g...> on Tue, 11 Mar 2003 09:28:25 +0800
As my quest to solve the sequential nos I have ended up with this query with the
help of my friend and from the other forum:

SELECT (SELECT COUNT(a.lngCargoID) from tblCTranx as a where a.lngCargoID <=tblCTranx.lngCargoID and a.lngCargoID >10) AS
SeqNo, *
FROM tblCTranx
WHERE tblCTranx.lngCargoID>10
ORDER BY tblCTranx.lngCargoID

This was just a very simple test query that I've done.  Just wondering, what if I have
30 fields to query on a 100,000 or more records with 5 joins or more, would the 'subquery' 
create great impact on making the query slower?

Thanks,

enzo c",)


-----Original Message-----
From: Enzo Zaragoza [mailto:enzaux@g...]
Sent: Tuesday, March 11, 2003 9:28 AM
To: P2P sql_language
Subject: Sequential numbers in a query



Hi,
	I'm doing a navigation bar which has the four navigation button (first, previous, next and last).
And I have a status which shows the record number the user is currently viewing in the recordset, for
example, "3/20"

	Is it possible to create a sequential numbers in a query? Because what I want to accomplish is
I'll have the sequential numbers as somehow the *record number* in a recordset.  

	Currently what I'm doing to show the current record number is by having a variable that holds
the total recordcount and I just add or deduct for every record movement (next or previous).  Are there
any better ways to do it?

Thanks,

enzo c",)


  Return to Index