[racktables-users] Re: help with sql needed

  • From: Denis Ovsienko <infrastation@xxxxxxxxx>
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Thu, 20 Jan 2011 17:23:10 +0300

[...]
> Now I want to fetch every server object which has a specific service
> contract set, and the corresponding customer tag as well.

With version 0.18.6 you can do that without SQL (though RackCode expression). 
These attributes are mapped to {$attr_X_Y} autotags, which can be used together 
with customer tags in your case.

> For the first part, this is fine with simple join, but adding the tag
> output doesn't seem to work well. If an object has no tag, the object
> isn't listed at all with my current query:
>
> select tt.tag AS Kunde, ro.Name AS Hostname, d.dict_value AS ServiceLevel \

[...]

"SELECT ... FROM table1, table" is equivalent to "SELECT ... FROM table1 INNER 
JOIN table2", at least in MySQL. To get the records you are describing you 
would need a LEFT JOIN. However, this is a less reliable solution, because SQL 
schema is subject to change over time.

-- 
    Denis Ovsienko

Other related posts: