Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


out there and back ( lcoal_data_id <-> local_graph_id)

 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin Development
Author Message
johnrembo
Cacti User


Joined: 24 Apr 2006
Posts: 198

PostPosted: Thu Dec 20, 2007 9:43 am    Post subject: out there and back ( lcoal_data_id <-> local_graph_id) Reply with quote

Hi,

could anyone please give me sql select which could return local_graph_id by local_data_id:

short form looks like:

Quote:
select xxx.local_graph_id
from yyy
where local_data_id=5


cacti sources are full of reverse solutions, when local_data_id is extracted by knowing local_graph_id, but this isn't what I need.

thank you
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9697
Location: MI, USA

PostPosted: Thu Dec 20, 2007 11:23 pm    Post subject: Reply with quote

It's a pain in the you know what. I did not write it, so I will not take the blame We hope to "FIX" it one day.

Either way, try this:

Code:
SELECT DISTINCT
graph_local.id, data_local.id
FROM graph_local
INNER JOIN ((data_template_rrd
INNER JOIN graph_templates_item
ON data_template_rrd.id=graph_templates_item.task_item_id)
INNER JOIN data_local
ON data_template_rrd.local_data_id=data_local.id)
ON graph_local.id = graph_templates_item.local_graph_id;


TheWitness
Back to top
johnrembo
Cacti User


Joined: 24 Apr 2006
Posts: 198

PostPosted: Fri Dec 21, 2007 4:42 am    Post subject: Reply with quote

TheWitness wrote:
It's a pain in the you know what. I did not write it, so I will not take the blame We hope to "FIX" it one day.

Either way, try this:

Code:
SELECT DISTINCT
graph_local.id, data_local.id
FROM graph_local
INNER JOIN ((data_template_rrd
INNER JOIN graph_templates_item
ON data_template_rrd.id=graph_templates_item.task_item_id)
INNER JOIN data_local
ON data_template_rrd.local_data_id=data_local.id)
ON graph_local.id = graph_templates_item.local_graph_id;


TheWitness


merry cristmas and gracias!

waiting for a new cactus plant in santas sock...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin Development All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group