Re: referring previous record of recordset from within sql statement
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Sun, 15 Oct 2006 05:26:04 -0400
shripaldalal wrote:
Hi,Again, without an ORDER BY clause, there is no such thing as a "previous
sorry the formatting is indeed confusing the entire issue
look for eg: let us say i do "select document_no, ledger_ac from
accounts"
it will display as:
Document_no Ledger A/c
JV/1 shripal dalal a/c
JV/1 Bank of india a/c
JV/2 Bank of Saurashtra a/c
JV/2 Cash in Hand A/c
I want it do display as:
Document_no Ledger A/c
JV/1 shripal dalal a/c
Bank of india a/c
JV/2 Bank of saurashtra a/c
Cash in hand a/c
you may notice that if the previous document_no is the same as the
current one then I do not want the current document_no to display
again. (Two records or more constitute one transactions here, since
they are part of accounts transaction).
So is there a way to refer the previous record....something like
record". In your example above, for the JV/1 document, you show the shripal
ledger displaying before the Bank of india one. This leads to two questions:
1. Is it important that the shripal record be first?
2. If so, what data exists in the table that will allow us to force it to be
shown first via an ORDER BY clause?
If the answer to 1. is "No", then do what Anthony suggests and loop through
the data, keeping track of which document_no you are working with through
the use of a variable. if "Yes", then you need to provide the answer to the
second question.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- Follow-Ups:
- Re: referring previous record of recordset from within sql statement
- From: shripaldalal
- Re: referring previous record of recordset from within sql statement
- References:
- referring previous record of recordset from within sql statement
- From: shripaldalal
- Re: referring previous record of recordset from within sql statement
- From: Bob Barrows [MVP]
- Re: referring previous record of recordset from within sql statement
- From: shripaldalal
- referring previous record of recordset from within sql statement
- Prev by Date: Re: referring previous record of recordset from within sql statement
- Next by Date: Re: referring previous record of recordset from within sql statement
- Previous by thread: Re: referring previous record of recordset from within sql statement
- Next by thread: Re: referring previous record of recordset from within sql statement
- Index(es):
Relevant Pages
|