EasyCFM.COM ColdFusion Forums / Coding Help! / Coldfusion Query Help

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Coldfusion Query Help

remove book mark from this topic Printer-friendly Version  send this discussion to a friend  new posts last

08-09-2013 @ 10:23 AM
Send P.M.
My Gravatar!
Powered by Gravatar
Joined: Aug 2013

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.


08-09-2013 @ 1:36 PM
Send P.M.
My Gravatar!
Powered by Gravatar
Posts: 4542
Joined: Jan 2002

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
webmaster@easycfm.com \\email

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

Website Designed and Developed by Pablo Varando.