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

In each group, fill the first row with a 0, and the successive rows with a 1

37
Let's say I have groups of data. In each group, I want the first row to be filled with a 0, but each successive row with 1's.

Here is an example of data output:

Account, Date, Yes/No
account1, 1/1/2008, 0
account1, 4/5/2009, 1
account1, 3/4/2010, 1
account1, 7/7/2011, 1
account2, 1/6/2008, 0
account2, 3/3/2009, 1
account2, 4/4/2010, 1
account5, 2/3/2008, 0
account5, 5/3/2009, 1
account5, 4/3/2010, 1
account5, 3/4/2011, 1

etc...

I'm not sure if the min, or first function can be used to accomplish this, but there must be a way. Thanks for any help!
Aug 1 '10 #1
1 1080
chopin
37
I was able to figure this out with the following logic in DAO (I'm just going to enter in quick human readable code. Since my project is actually a little different than what I had asked, I don't want to confuse you all with code that may not make sense unless you know my project.)

Expand|Select|Wrap|Line Numbers
  1. Do Until rst.EOF
  2. If Account = AccountPrevious Then "1", Else "0"
  3. Loop
  4.  
DAO is a nightmare to learn, but I discovered the "step into" function today, and this really helps the debugging process.
Aug 1 '10 #2

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

Similar topics

3
by: Kangan | last post by:
Hi, Is there a way to display just the first five rows of the query stt result in DB2. I know that there is something called select Top 5 * from tablename in SQL Server 2000. Is there a wayaround,...
8
by: Evan Smith | last post by:
During a routine performance check using an event monitor, I discovered a class of query whose performance has me baffled. The monitor captured: SELECT * FROM EWM_CASE fetch first 1 rows only...
6
by: neptune | last post by:
I must be missing something obvious. I have 3 fields and sample data. 7890 26592 7/15/2003 7890 13645 10/6/1999 7890 58741 6/21/1992 I...
5
by: Roy Gourgi | last post by:
Hi, Is there a way to group rows by some columns in such a way that I can clearly see them in a distinguished fashion when I look at a view or table. This is my code below but when I try using...
14
by: sangram.0149 | last post by:
hi, can someone plz help me on this one i need to fetch the first record from every group of records with the same emp id. i cannot use group by because i want to fetch all the fields...
2
by: Andrew Lias | last post by:
Let us say that I have a table with two sets of values as such: Item Extension --- ---- 100023 1 100025 1 100025 2 100028 1 100029 1 100029 2
11
by: jimstruckster | last post by:
I have a table with 10 rows, I want all rows except for the first to be hidden when the page first opens up. If the user puts a value in a text box in the first row then I want the second row to...
5
by: bruxerjk | last post by:
I need to do the following. I want to copy cells from a number of Excel files, say "1.xls", "2.xls", "3.xls", etc, into successive rows of "All.xls". That is, I'd open "1.xls", copy cells and...
1
by: Mar72Vin | last post by:
Hi All, If a datagridview only has a few records the grid looks very untidy because there is is lot of blank space in the grid. Is there anyway to tell a datagridview to fill the entire viewable...
3
by: BulbFresh | last post by:
Hi, I'm using Access 2000 and importing .csv files to a table. This works very well apart from one column which sometimes will be a short note (text < 255 characters) and sometimes a long...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.