473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Select top records without using TOP keyword

Here we are using CTE

Expand|Select|Wrap|Line Numbers
  1. WITH CTE AS (
  2.    SELECT Col1, rowno = row_number() OVER(ORDER BY Col2)
  3.    FROM Table
  4.  
  5. )
  6. SELECT *
  7. FROM   CTE
  8. WHERE  rowno BETWEEN 1 AND 5
Nov 12 '13 #1
1 1481
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code or formatted data.

What is your question? You seem to have answered yourself.
Nov 13 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Danny | last post by:
How to allow users to select a set of records and then let them change a field for all these records at once? I would like to do this in code on a form. I will have a form with tabular view of...
4
by: Brian | last post by:
I hope this will make sense. I'm trying to filter the records in a table based on records in a 2nd table. The trick is, I can't use a query. I'm trying to filter down the number of records going...
4
by: Cybertof | last post by:
Hello, What is the difference between : - adding a new reference to a namespace within the SolutionExplorer (right click, Add Reference...) - adding a new reference with the 'using' keyword in...
6
by: Barry | last post by:
Hi, I have created a dataset programmatically. I want to be able to run sql statements on this if possible, however I can't seem to get around the fact that I have to set up a connection, problem...
4
by: NetMasker | last post by:
How can I reference a form (from withing a module for example) and make it visible without using the keyword "Me" ? I tried with the following code but nothing happened: Public myform As Form1...
3
by: padhuwork | last post by:
Hi, I m actually making a Windows DLL using VB 6. I have modified the Link.exe, so that, it compiles a Windows DLL. I m now struck with this. I add reference "Microsoft Scripting Runtime"...
5
by: Chris Cowles | last post by:
I use an application that uses Oracle 8.1.7. All functions of the application are completed with calls to stored procedures. A data entry error occurred that caused thousands of records to be...
2
by: Hamayun Khan | last post by:
Hi all I am using the following query to select records for table Select JobTitle,JobDesc,Scraped,logoimage,JobPostID,SchoolID,web,MemType,InstitutionName,PayScale,LEA,Contract as...
0
by: Gordon Padwick | last post by:
A form contains controls, one or more of which can be other forms. A form that contains another form is known as a main form. A form contained by a main form is known as a subform. A subform itself...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.