Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 17th, 2003, 04:40 AM
Registered User
Join Date: Sep 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Descending order Query problem

Suppose my database has 50 records and my query is as:

select distinct(l.sno), c1.cname source, c2.cname dest, c3.cname protocol, l.dest_port
from Log l, Objects o1, Component c1, Objects o2, Component c2, Services s, Component c3
where ((l.source_ip=o1.objlowip) and (c1.cid=o1.objid))
and ((l.dest_ip=o2.objlowip) and (c2.cid=o2.objid))
and (((l.dest_port=s.supp && slowp) and (l.protocol=s.protocol)) and (s.sid=c3.cid))
order by sno desc limit 2,10;

It will display the 10 records starting from last and leaving last 2. But if I want to display 10 records before sno=48 i.e. by specifying sno in my query. How can I modify my query i.e. how can I specify sno.

Old September 17th, 2003, 11:44 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

(cross post with http://p2p.wrox.com/topic.asp?TOPIC_ID=4191)

Have you tried using a (sno < 48) in your where clause?

Take care,


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using ORDER BY in SQL query in ASP page saifi4u Classic ASP Databases 1 February 29th, 2008 09:19 AM
SQL "Order By" problem bear88 SQL Language 1 April 12th, 2005 12:18 AM
Sort ascending and descending bertcox XSLT 1 May 17th, 2004 05:36 AM
MySQL query desc order problem dssachdeva MySQL 3 September 18th, 2003 01:11 AM
Desc order problem dssachdeva Oracle 0 September 17th, 2003 04:42 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.