• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

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