|
|
| Author |
Message |
pgb205
Joined: 10 Nov 2008 Posts: 17
|
Posted: Fri Nov 14, 2008 4:03 pm Post subject: finding out local_graph_id from local_data_id??? |
|
|
How would I find out what the local_graph_id is for a certain data source.
So basically how would i find out what the graph_templates_graph.local_graph_id is from knowing the local_data_id??
Can't figure out how to join the tables to retrieve the data.
thanks |
|
| Back to top |
|
 |
browniebraun Cacti User
Joined: 13 Jun 2006 Posts: 341 Location: Cologne, Germany
|
Posted: Fri Nov 14, 2008 4:33 pm Post subject: |
|
|
| Code: | $local_data_id = 12345;
$sql = "SELECT DISTINCT c.local_graph_id
FROM data_template_data AS a
INNER JOIN data_template_rrd AS b
ON b.local_data_id = a.local_data_id
INNER JOIN graph_templates_item AS c
ON c.task_item_id = b.id
WHERE a.local_data_id = $local_data_id";
$local_graph_id = db_fetch_cell($sql); |
That's the way I do it.
Best regards
-Andreas- |
|
| Back to top |
|
 |
pgb205
Joined: 10 Nov 2008 Posts: 17
|
Posted: Mon Nov 17, 2008 9:21 am Post subject: |
|
|
| well, I don't really understand how your query works but it works for me. Thanks a bunch. |
|
| Back to top |
|
 |
|