Topic: Coldfusion Query Help

ColdFusionDude    -- 08-09-2013 @ 10:23 AM
  Hello, I"m looking for a way to write a query to retrieve some information, and I'm not having much luck.

I'm mapping out our company network.  Basically I have devices.  Each device can have interfaces, and devices are connected to each other through these interfaces.

The connections table is comprised of a unique identifier, and two interface fields.  From these interface fields I can then pull all pertinent device information.

So, given an interface, I need to pull all devices in the 'chain' of connection.

For example, given an interface of 8, say this is connected to interface 4 and 9.  I can pull these easily.  But then I would also need to pull what 4 is connected to, and also what 9 is connected to.  And so on until there are no more connections found.

Can anyone give me an idea of how to do this?  I'm running CF8 with a MySQL 5 database.


Webmaster    -- 08-09-2013 @ 1:36 PM
  There are many methods to achieve this. It all depends
on how you are looking to do it.

1. You can use Left/Right approach in which each record
belongs to a left and right value. That allows you to
work your way up easily in code... (Example here:
nested-sets-how-to-find-parent-of-node )

2. Create the main call, then do a nested call (until
the returned query = record of 0 )... A little more
intensive, but much easier to do.

The thing here is how many connectors they can be tied
to, and will they differ by record, etc... lots of
things going on so it's more complicated then me just
saying "do this".... if that makes sense.

Pablo Varando
Senior Application Architect

904.483.1457 \\ mobile \\email

\m/ (>.<) \m/
--- rock on ---

EasyCFM.COM ColdFusion Forums :