Grouping of Records from Database

  • I have two databases, one that is very large(million+ records) and another that is only 7000 records.  The first database is essentially a phone directory type database and the second is a contact database.  I would like to combine the two databases and then run a query that would return each of the 7000 records from the database as well as the 5-10 records surrounding that record when sorted alpha by company name.  Thank you for any help you can provide.

    James

  • Two databases, or two tables?

    Can you provide the table's structure, some sample data and an example of what you want please

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • The data is in one table with the following basic format:

    CompanyName|ActContact|.......(Address Fields)

    ABC CO| |

    ABD CO| |

    ABE CO| |

    ABF CO|Y|

    ABG CO| |

    ABH CO| |

    ABI CO| |

    In the previous data example I would like to run a query on the Y in the ActContact field and also return ABD, ABE, ABF, ABG & ABH(the 2 records before and the 2 records after the record with Y in the ActContact field as well as the record with Y in the ActContact Field.  The problem is that I have 7k+ records that have the Y attribute set in a table of over a million records.  Thank you.

    James Thurber

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply