Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Query needed to "spider" items together

Author  Topic 

somacore
Starting Member

1 Post

Posted - 2008-12-09 : 11:48:42
Hi all,

For my application I need to be able to compare items in a database and output how they're all related. For example:

Ticket #1 Programs:
AA39
FR08
AA05

Ticket #2 Programs:
AA39
FR08
VS01

Ticket #3 Programs:
VS01
WB10

Ticket #4 Programs:
AA01

Now let's say someone wants to do a "spider" (that's what we call it, don't hate me) on Ticket #1.
The query should select all the programs from Ticket #1 and then select any tickets that have programs matching Ticket #1.
The query find Ticket #2 has matching programs, so it should then look at all the programs in Ticket #2 and select any other tickets that have programs matching Ticket #2, and so on.
So, if you do a spider on Ticket #1, you'd get back:

Ticket #1: aa39, fr08, aa05
Ticket #2: aa39, fr08, vs01
Ticket #3: vs01, wb10

I have no clue how to start on this, but I'm determined it can be done with one query.

Thanks for any help.

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2008-12-09 : 12:57:00
Tough to do with SQL in Access.
You are going to need to write a VB script that creates a temporary table and then enters a loop that inserts distinct related records into the table until no new related records can be found.

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page
   

- Advertisement -