ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add add number (https://www.excelbanter.com/excel-programming/292378-add-add-number.html)

JA[_2_]

Add add number
 
I have a group query:

SELECT Course.course_code, Course.course_name, Count
(Course.ID) AS CountOfID
FROM Course
GROUP BY Course.course_code, Course.course_name;

Is there any way I can add a numbering field (using the
build wizard or any way)to give numbering to records.

Please advise.

patrick molloy

Add add number
 
you already have a numbering field...
Course.ID

change you SQL to
SELECT Course.ID, course_code, course_name, _
Count(Course.ID) AS CountOfID
FROM Course
GROUP BY course_code, course_name;

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
I have a group query:

SELECT Course.course_code, Course.course_name, Count
(Course.ID) AS CountOfID
FROM Course
GROUP BY Course.course_code, Course.course_name;

Is there any way I can add a numbering field (using the
build wizard or any way)to give numbering to records.

Please advise.
.


Dianne

Add add number
 
If Course.ID isn't satisfactory as a numbering field, you could try
something like this:

SELECT
C1.course_code,
C1.course_name,
( SELECT count(*) FROM Course C2 WHERE C2.Course_code <=
C1.Course_code ) as Counting
FROM Course C1 ;

--
HTH,
Dianne

In ,
JA typed:
I have a group query:

SELECT Course.course_code, Course.course_name, Count
(Course.ID) AS CountOfID
FROM Course
GROUP BY Course.course_code, Course.course_name;

Is there any way I can add a numbering field (using the
build wizard or any way)to give numbering to records.

Please advise.




onedaywhen

Add add number
 
Who said Course.ID is a number? But I admit it's a good bet. Someone
who would take a non-procedural, set-orientated language like SQL and
use it to create cursor is more than likely to choose a IDENTITY
column as a primary key, right?

--

"Patrick Molloy" wrote in message ...
you already have a numbering field...
Course.ID

change you SQL to
SELECT Course.ID, course_code, course_name, _
Count(Course.ID) AS CountOfID
FROM Course
GROUP BY course_code, course_name;

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
I have a group query:

SELECT Course.course_code, Course.course_name, Count
(Course.ID) AS CountOfID
FROM Course
GROUP BY Course.course_code, Course.course_name;

Is there any way I can add a numbering field (using the
build wizard or any way)to give numbering to records.

Please advise.
.



All times are GMT +1. The time now is 05:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com