Add a line/row number in front of query results

How can a add a line number in front of the returned query results?

Example:  If a query returns 3 records:
Dog
Cat
Mouse

I would like to query to return the results with line numbers:
1 Dog
2 Cat
3 Mouse

The query would add line/row numbers for the returned results.

Thank you in advance, I have asked this question in the past but having a 
hard time in trying to explain this simple concept or maybe its not so 
simple.

Michael Kintner 


0
Michael
10/11/2007 3:06:02 PM
access 16762 articles. 3 followers. Follow

1 Replies
7045 Views

Similar Articles

[PageSpeed] 0

RowNum Sample

SELECT  (SELECT COUNT(*)+1 FROM PERMISSIONS P1 WHERE P1.ID < P.ID) AS 
ROWNUM, P.*
FROM PERMISSIONS P

HTH

Pieter

"Michael Kintner" <michaelkintner@nospam.com> wrote in message 
news:13gseuq3osdpe58@corp.supernews.com...
> How can a add a line number in front of the returned query results?
>
> Example:  If a query returns 3 records:
> Dog
> Cat
> Mouse
>
> I would like to query to return the results with line numbers:
> 1 Dog
> 2 Cat
> 3 Mouse
>
> The query would add line/row numbers for the returned results.
>
> Thank you in advance, I have asked this question in the past but having a 
> hard time in trying to explain this simple concept or maybe its not so 
> simple.
>
> Michael Kintner
> 


0
Pieter
10/11/2007 3:15:53 PM
Reply:

Similar Artilces:

OLAP query problem
Hi, I have installed Windows XP SP2 + Office 2000 SR1, when I want to create a OLAP database query, I can not find the dirver "Microsoft OLE DB Provider for olap service8.0", there is only a driver "Microsoft OLE DB Provider for olap service" (without 8.0). Where can I install the 8.0 driver? Thanks in advance Kevin I found the answer by myself. I hope it could help for others in the newsgroup: http://support.microsoft.com/default.aspx?scid=kb;en-us;303438 "Kevin Dai" <Kevin_Dzy@Hotmail.com> д����Ϣ����:%23ETmqihnFHA.420@TK2MSFTNGP09.phx.gbl... &...

Row limits with Publisher
Is it possible to exceed publisher table limit of 128 rows? I have a spreadsheet that I want to import with almost 2,500 rows. Thank you in advance for your assistance! Regards, Chuck cbouline wrote: > Is it possible to exceed publisher table limit of 128 rows? I have a > spreadsheet that I want to import with almost 2,500 rows. Thank you in > advance for your assistance! Given that Publisher can't flow tables across pages, that's going to have to be a really long page! (I don't have an answer for your question.) -- Ed Bennett - MVP Microsoft Publisher http:...

Review commonly used add-ins
Hi, MS should review the various add-ins available on the web and seek to use many of those features in their next edition. New worksheet functions such as GETELEMENT(), SUMCOLOR() and many many more would be great. Color in particluar is a nightmare, so many users like to adopt color but from an analytical perspective it's impossible to work with, you can't incorporate within formula, you can't filter etc. etc. Also, look at ASAP Utilities, they have heaps of cool utilities that make a difference, something as small as unhiding all sheets can be a great time saver. The...

Using Names, ie ALPHA as Purchase Order Numbers
I have been told that if i use any alpha based purchase order numbers may cause RMS to crash. In order to track customer orders it would be easy to use their name as the order number. Is this advisable? -- dave dave wrote: > I have been told that if i use any alpha based purchase order numbers may > cause RMS to crash. In order to track customer orders it would be easy to use > their name as the order number. Is this advisable? I think you can use the alpha on PO number only in prefix.. the manager found the next po number using the right chars of PO number. cod Dave I was ...

Row Inserts
I notice that in Excel 2003 you can protect a sheet but have an option that would continue to allow rows to be inserted. Is there a way to do this in Excel 2000? When I protect the sheet then row inserts are no longer allowed. Thanks for any help. Mike B -- Disclaimer: Any comments made are personal and do not reflect the thoughts or policies of this company. Hi Mike, You can insert the rows with a macro, as long as the macro turns off protection. You do not need a password for protection but if you do, then the macro would have to use that password. For macros to insert rows see ...

Change scroll rows from 1 to 3 with mouse wheel
Does anyone know how to set the mouse scroll amount from 3 rows to 1 row in Excel 2007? There used to be an option in 2003, but I can't find one in 2007. It is set in Mouse in the Windows Control Panel needhelp wrote: > Does anyone know how to set the mouse scroll amount from 3 rows to 1 row in > Excel 2007? There used to be an option in 2003, but I can't find one in 2007. ...

Row formatting based on cell content #2
That didn't turn out the way i had hoped to explain what i get in m files....but if you can imagine a space in the first colum where heading appears BLUETOOTH DBT120 D-LINK Bluetooth USB Adapter DCF650BT D-LINK Bluetooth PDA Compact Flash CABLE CABLE - SURGE FILTER SF001NP SURGE FILTER PC POWER CABLE CABLE - IDE HDD/CD ROM AUDCAB AUDIO CABLE - BLACK TO BLACK IDECAB IDE DATA CABLE (HDD/CD ROM) - 3 drop IDECAB133 IDE DATA CABLE -ULTRA ATA 133 (HDD) CABLE - NETWORK CABUTP005 0.5 METRE UTP RJ45 LEVEL 5 NETWORK CABLE CABUTP01 1 ...

FetchXml to SQL Query
I'm looking for a tool that converts FetchXml to equivelent SQL Query. Can you help? Not aware of anything that does this. If you are fairly handy with XML though it shouldn't be that difficult to write. -- Matt Parks MVP - Microsoft CRM "CRM Chief" <CRMChief@discussions.microsoft.com> wrote in message news:600AB470-BCA8-48F9-9CD8-652835945661@microsoft.com... I'm looking for a tool that converts FetchXml to equivelent SQL Query. Can you help? ...

identifying odd/even numbers
Is there a formula or easy way way for excel to identify if a number (thousands of numbers) is odd or even? Thanks --- Message posted from http://www.ExcelForum.com/ One way: Even: =MOD(A1,2)=0 Odd: =MOD(A1,2)=1 If you load the Analysis Toolpak Add-in, you can use the ISODD() or ISEVEN() functions. Note that ISODD works a bit differently, since it truncates numbers, so if A1 = 3.5 =MOD(A1,2)=1 ==> FALSE =ISODD(A1) ==> TRUE In article <rdy4trvl.z2p1m@excelforum-nospam.com>, rdy4trvl <rdy4trvl.z2p1m@excelforum-nospam.com> wrote: > Is ...

How to add records to a table through a data access page?
I have set up tables and queries in a database, and am outputting them to a report, however what i want is to have users enter the data to the required fields through a Data Access Page. I have set up the DAP with all of the info, however when i include the ADD command, and try and use it, i am prompted with the error message that i cannot add because the recordset for the page is read only. I have tried the access help info to discable, however it says to find the read only property which i have not been able to locate. Any help that can be given will be greatly appreciated. Thanks ...

Insert / remove a row from protected sheet excel 2003 #2
Hi, I have my worksheet protected. I set the frist 5 rows all cells to Locked. The rest of the cells are Unlocked. When applying protection I ticked the boxes saying allow insert of row and allow delete rows. Yet when the protection is applied the icons / menu options for inserting / deleting rows are grayed out. What am I doing wrong? Thanks! Michiel. ...

Number format for basis points
Hello I am certainly not the first to ask but I didn't find an answer yet. Is there anyway to create a custom number format that allows to display basis points in Excel? For instance if I have a cell with the formula "=2.5%%", I would like to see "2.5bps" appearing. "0.0%%" allows to get "2.5%%" appearing. Any trick to get beyond that step? thanks in advance Charles Use a custom number format of 0.0"bps" and just enter 2.5 -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Charl...

Help with query 04-20-10
Hello, I need some help with a query that I can't quite figure out the logic for. I need to select the primary key field from table1 where there are no records in which field1 are null and in which the number of records in which field1 =1 is greater than zero. I've tried several permutations to get this query to work and have not had success. Can someone give me a hand please? Thanks S I am not sure I understand the requirements, but see if the following example will help: CREATE TABLE table1 ( keycol INT NOT NULL PRIMARY KEY, datacol INT); INSERT INTO...

Add new col event?
I have a protected worksheet. I would like to allow the adding of columns only in the B to =MATCH("Totals",B1:AZ1,0) range. Is this possible? Is there an event for the adding of a column so I can recalculate some other things when someone adds a column? Thanks. Maybe you could ask the user where they want to insert the column and if it's ok, you could do the insertion. If that's ok.... Option Explicit Sub testme() Dim myRng As Range Dim okRng As Range Dim Res As Variant Dim rngToCheck As Range Dim OkToInsertRng As Range Dim myPWD As String ...

How do I add shapes to Process Engineering Component Explorer?
I'm using Visio 2003. Is there a way that I can use the "component explorer" and "connectivity explorer" from the Process Engineering stencil with my own shapes? What shapesheet attribute makes a shape appear on this explorer? Thanks. The Process Engineering menu has a Shape Conversion command that should enable this. You just need to assign a category. -- Mark Nelson Office Graphics - Visio Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Barney" <peter.barnfield@gmail.com> wrote in...

prohibit users from creating new sites/part numbers
GP 8.0 when you type in a site for example in the transfer screen and the site doesn't exist, the program asks you if you want to create it. We do NOT want anyone creating new sites or part numbers who isn't in the Logistics group. Is there any way to prohibit this behavior by the program. I 've looked all through advanced security and turned off the cards for a certain class of user, but the program still asks if they want to create a new site/part number. I do not have Field Level Security module. Thanks! Margaret Margaret, The next step, after the user says Yes to se...

Trying to get user id in a query
I'm trying to get access to the security variables in an access 2003 session, in order to get the userid or user name and use it as a parameter in a query. Is there any way to do this? Regards, Javier Garc=EDa Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function UserNameWindows() As String Dim lngLen As Long Dim strBuffer As String Const dhcMaxUserName = 255 strBuffer = Space(dhcMaxUserName) lngLen = dhcMaxUserName If CBool(GetUserName(strBuffe...

Hidden Recipients show up in query-based distribution group
I have several recipients that I have hidden from the GAL because they have left the company, but they still show up in the Preview tab of our query-based distribution groups. Does anyone have a solution to this problem?? Thanks, Dave modify the ldap query to exclude recipients with msExchHideFromAddressLists attribute (set to true)... ? -- Bharat Suneja MCSE, MCT -------------------------------- "DaveF" <DaveF@discussions.microsoft.com> wrote in message news:7E57B631-E4F4-4B39-99F0-C1F4FA784CC0@microsoft.com... >I have several recipients that I have hidden from th...

Front end Backend OWA issue
Front end is running exchange sp1 on windows 2003 no sp backend is running exchange sp1 on windows 2003 no sp. I have two backends they are configured the same as far as SP's an OS. I am testing out OWA access. I have configured the front end with forms based auth and configured a cert, in IIS on the default web, and forced ssl on /exchange dir. I unchedked require ssl on the backend /exchange on both servers and i configured forms based on both servers. I exported the certificate that is currently being used on one of my backend servers (backend.mydomain.com) and i installed this c...

Monthly outstanding query
HI, I have a Receivable table with CustID, DueDate and AmountDue. Another Receipts Table with CustID, RctDate, AmountPaid. How can I make a query to display What was collectable each month and What was actually collected? No problem with getting monthly collections part. Where i am getting stuck is that I need to add the outstanding of the previous month for each month. Any help please. Thanks Ramesh Hi Ramesh, try this: PrevDue: dSum("AmountPaid", "[Receivable Table]", "CustID=" & [tablename].CustID & " AND DueDate <=#" &...

Create separate chart for each row in excel
I am attempting to create a separate chart for each row of my worksheet (about 300 rows = 300 separate charts). Is there an easy way to do this? The actual data range will change month-to-month, so I would not want to have to recreate 300 new charts each month individually. While I have never created (or tried to create) 300 charts in a single workbook, it is easy to believe that performance and stability of Excel might become a question. Do you have to have 300 charts? Or will one chart (or a few) that can be easily changed to reflect new data suffice? If so, adapt the ideas behind ...

Top row of excel stays even in sorting
I need a header in the top row of my excel worksheet so that even when I sort the data the top row remains the same. 2003:- Data>>Sort>>My Data Range As>> Check the “Header Row” Option Button. 2007:- Press Alt+D+S the Sort Dialog Box will appear Press Alt+H which will select the “My Data has headers” check box. -- Remember to Click Yes, if this post helps! -------------------- (Ms-Exl-Learner) -------------------- "willyd" wrote: > I need a header in the top row of my excel worksheet so that even when I sort > the data the top ro...

Blue and red lines in layout guides
I know this must be a fairly fundamental question - but I have alwayss wondered the significance of the red and blue lines in layout guides. I know HOW to use layout guides and alter them. I also understand RULER guides. What I don't know is WHY we are provided with both red and blue lines in layouts - I know I can alter the position of margins but this moves both red and blue lines. Is it possible to alter the distance between these 2 different lines and what is their significance. Just asking as I wonder if I'm missing something crucial here. Many thanks Ron The outside blue guide...

Maintaining a constant result
In a spreadsheet I use to calculate cost of a contract plus the profit I would like to maintain the same cost amount by changing the percentage of profit up or down when a direct cost amount is changed. On Mon, 29 Mar 2010 14:24:16 -0700, Chris <user@msgroups.net/> wrote: >In a spreadsheet I use to calculate cost of a contract plus the profit I would like to maintain the same cost amount by changing the percentage of profit up or down when a direct cost amount is changed. > >--- >frmsrcurl: http://msgroups.net/microsoft.public.access Do you have a question about Micr...

Only allow certain numbers based on another value
Excel 2007 - I have a worksheet that has a column that shows the number of available units left based on the sum of units at all locations. So, there is only 6 available at any given week. I then sum up columns D:K and then input how many are available from the 6. So if column D shows 2 and none of the other columns show usage then there are 4 left for that week. My problem/issue comes when I want to only allow the individual entering a number for that week to only be able to enter up to what is available that week. So in the example, the next user could only enter 4 since t...