• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 321
  • Last Modified:

group count

I am trying to enter a group count by order to the id ascending.file attached.thanks
Database11.accdb
0
Svgmassive
Asked:
Svgmassive
  • 3
  • 2
2 Solutions
 
Rey Obrero (Capricorn1)Commented:
try this query

SELECT dbo_Log.ID, dbo_Log.Sequencenumber, (select count(*) from dbo_log as d where d.id<=dbo_log.id and d.Sequencenumber=dbo_log.Sequencenumber) AS Expr1
FROM dbo_Log
ORDER BY dbo_Log.ID;
0
 
SvgmassiveAuthor Commented:
capricorn that great if i want to do a running count how would i do that?
0
 
Rey Obrero (Capricorn1)Commented:
what do you mean, running count? post an sample result.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
hnasrCommented:
Check:
SELECT a.Sequencenumber, a.ID, (Select count(ID) from dbo_Log b where b.Sequencenumber=a.Sequencenumber and b.ID<=a.ID) as seq_group
FROM dbo_Log a
order by a.Sequencenumber, a.ID;

Open in new window

0
 
SvgmassiveAuthor Commented:
sequential numbers
0
 
Rey Obrero (Capricorn1)Commented:
see if this is waht you want


SELECT dbo_Log.ID, dbo_Log.Sequencenumber, (select count(*) from dbo_log as d where d.id<=dbo_log.id and d.Sequencenumber=dbo_log.Sequencenumber) AS Expr1, (select count(*) from dbo_log as d where d.id<=dbo_log.id) AS Expr2
FROM dbo_Log
ORDER BY dbo_Log.ID;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now