Re: Can a query find info X numbr of rows from target info?



Hi, David:

Thanks for your response. (I have been away for the Thanksgiving holiday
and just checked back in.)

Yes, when I import the data file, I am letting Access create an index. So
each row is sequentially numbered, giving me the desired explicit sort order.

I can see where you're going with the join (n=n-1) but I don't have that
type of statement in my SQL. I was getting a little lost translating between
my names and your example, so I renamed my data "tbl" & "fld" so I could make
an exact comparison between my SQL & your advice. This is what I'm getting:

SELECT tbl.fld
FROM tbl INNER JOIN tbl AS tbl_1 ON tbl.ID = tbl_1.ID
WHERE (((tbl.fld) Like "*dumpend*"));

I only have the one field in the table (aside from the index), so do I need
to do this part?

> select * from tbl inner join tbl as tbl1 on (tbl.pk = tbl1.pk-1)
> where tbl.fld = 'dumpend'

I didn't understand the "pk" part, as I don't see this in my SQL.

Thanks very much for taking the time to help me.

Ann

"david@epsomdotcomdotau" wrote:

> Excel has Row and Column names, with an explicit sort order.
>
> If you want to do something like that in Access, you need
> a numeric Row index I see that you have Column (Field)
> namesL: Do you have Row names (Primary Key). If you
> do have a Primary Key, does it have an explicit sort order?
>
>
> Start in the query design view by adding the table, selecting
> the 'dumpend' records.
>
> Then add the same table again, and join on the index field.
>
> Then go into SQL view, and change the join from (n=n) to
> (n = n-1).
>
> select * from tbl inner join tbl as tbl1 on (tbl.pk = tbl1.pk-1)
> where tbl.fld = 'dumpend'
>
>
> Test as see that it is working. When happy, START AGAIN
> (you can't go back to design view) with 4 joined copies of
> the table, and change all 4 joins in sql view.
>
> (david)
>
>
>
> "Ann Scharpf" <AnnScharpf@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:FC2D4249-5AE7-4818-94BC-4F7D9FC26F08@xxxxxxxxxxxxxxxx
> > Hi. I am running Access 2003 under Windows XP. I have a crazy looking
> > output file that I need to analyze. The system we are working with
> creates
> > output files that can run 3,000 - 35,000 rows long by two columns wide.
> Of
> > these rows, maybe a few hundred are relevant to our needs.
> >
> > Column 1 is basically throwaway. One of the things I need to do with the
> > column 2 data is find information that is 1, 4 or 5 rows below a target
> > phrase. For example, if row 156 contains the word DUMPEND, I need to
> > identify the the words that appear in rows 157, 160 and 161.
> >
> > I know that in Excel I could concatenate the words based on cell
> references.
> > Is there a way in Access to concatenate data based on the records'
> relation
> > to one another in the same table?
> >
> > Thanks for any help you can give me.
> >
> > Ann Scharpf
>
>
>
.



Relevant Pages

  • Re: Issues with CHANGE_TRACKING AUTO after initial index population
    ... There's a problem with 64 bit SQL 2005 server. ... Director of Text Mining and Database Strategy ... started the FT initial index population when our site activity is low. ... High activity on the data file. ...
    (microsoft.public.sqlserver.fulltext)
  • XML Bulk import problem
    ... I tried the samples in the SQL XML SP2 download and they worked just fine. ... Unexpected NULL value in data file ... Dim oBulkLoad As New SQLXMLBulkLoad3 ...
    (microsoft.public.sqlserver.xml)
  • Re: Is there a maximum size to a Python program?
    ... Thanks John, I understand where you are coming from and will try and digest ... problem with a generating a single SQL statement to cover all requests. ... The idea is that instead of reading a data file and generating SQL per ... and I am new to Python. ...
    (comp.lang.python)
  • Re: System table 13 error - trying to upgrade 7 to 2K
    ... All of the system tables live in the First data file (called the Primary ... Wayne Snyder, MCDBA, SQL Server MVP ... I support the Professional Association of SQL Server and it's community of SQL Server professionals. ... > I did a simple backup from sql 7 and tested the restore> back to 7, then created a blank db in my sql 2000 system,> then tried to restore the MEX database. ...
    (microsoft.public.sqlserver.server)