473,396 Members | 1,992 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,396 software developers and data experts.

Adding counter ID to set of data within group

I would like to add a "counter ID" to a set of grouped data within a query. For example, if I have 5 records, 2 with a value of A and 3 with a value of B, I would like to see the following results:

a 1
a 2
b 1
b 2
b 3

Can anyone help?
Oct 27 '06 #1
5 3460
NeoPa
32,556 Expert Mod 16PB
This can't be done within a query unless you have a Public Function which returns the value.
As the number of the Groups is indeterminate this would be v hard to code safely.
You could have a field in the table which could be updated by code but this also would be exposed to all sorts of drawbacks.

Essentially the answer is that queries don't support this.
Their strength is in accessing large amounts of data and data manipulation WITHIN records. Inter record relationships is completely outside their scope.
Oct 27 '06 #2
PEB
1,418 Expert 1GB
Hi

There was a way using subquery... but the ID of the records participated also... So if you need to distinct which one is the first and which one the second??? So really you need the ID that is autoincrement or sorted Ascending

In this forum there was a very good exemple for this... Now it isn't in my mind!

Select Group,ID, (Select Count(Group) As Result FROM Mytable AS MYT WHERE MYT.Group=[Group] AND MYT.ID<[ID]) AS Count FROM Mytable;

It was something like this as SQL

But it's just like an idea!

:)
Oct 27 '06 #3
NeoPa
32,556 Expert Mod 16PB
You don't have an 'AutoIncrement' in a query surely PEB?
I'd be very interested to learn about it if it does exist.
Oct 27 '06 #4
PEB
1,418 Expert 1GB
Ok! The autoincrement value, I assume is the primary key of the table that is used to be enumerated!

Really this isn't an autoincrement on a query!

In fact an autoincrement in a query can be done programaticcally in a field that isn't defined as an autoincerement! But it's a lot of work! :) That sometimes doesn't matter!

:)
Oct 27 '06 #5
NeoPa
32,556 Expert Mod 16PB
OK PEB.
Thanks for the prompt reply :-)
Oct 27 '06 #6

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

Similar topics

11
by: TomCat | last post by:
Hello, can anyone send me a link or even some sample of script that counts visits to a website ? Thanks, TomCat
3
by: kaston3 | last post by:
var totalpoints=0; for (counter=1;....){ myvalue=parseFloat(document.forms.elements.value); totalpoints+=myvalue //the fields in elements are always numbers }
5
by: alan_atwood | last post by:
I am looking to produce a query that will in addition to displaying the data will generate a counter that will be incremented by one with each row of the resultset. For example, my resultset would...
4
by: blisspikle | last post by:
The following sub form1_load reads in a text file that will say something like the text below. I think that the problem is that every time I add a class V_Sensor into the arraylist it puts it in...
4
by: bpneary1 | last post by:
First of all, I want to thank everyone who posts messages in this group. I am very new to VB and developing full-blown database apps, and I have learned a great deal by reading these posts, so I...
2
by: Justin Fancy | last post by:
Hi everyone, I need some help. I'm placing text files into a created database using vb.Net. The problem is that, i need two seperate sql statements to add both files because they are in...
1
by: zenfor | last post by:
Hi, I have a simple script I found that increments a number in a text file. I was wondering if anyone has a routine that will commify the number. Thank you! =============== <% counter_file...
1
by: access345 | last post by:
I am trying to streamline my forms by just having one form that does two functions. My form is called frmInformation my textbox is called txtSerialNumber. On the form I have that Data entry function...
0
by: dixonjm | last post by:
Hi There, I am looking for a little help with direction on how to do the above. Basically I have a sql database which contains a table of properties - this table contains a description col, a...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.