I'm just not getting this join right. If I do a
my @row = $dbh->selectall_arrayref("SELECT IP, ServerName, Domain, Day
+sUptime, OS, RAM, OSSP, InstallDate, CPUSpeed, CPUCount, CPUType FROM
+ hosts LEFT JOIN info ON hosts.IP = info.IP");
My 2 tables get joined. The only issue is that I get a warning:
Execution ERROR: Ambiguous column name 'IP' called from /usr/lib/perl5
+/vendor_perl/5.8.6/i586-linux-thread-multi/DBI.pm at 1557.
But if I try and change a column name, every field returned contains the "IP" value, regardless of what the true value should be.
Also, when I try to join a 3rd table it takes a long time. The 2 tables are done in less than 15 seconds. When I add the 3rd table it's just over 5 minutes.
my @row = $dbh->selectall_arrayref("SELECT IP, ServerName, Domain, Day
+sUptime, OS, RAM, OSSP, InstallDate, CPUSpeed, CPUCount, CPUType, Par
+titionFree FROM hosts, disks LEFT JOIN info ON hosts.IP = info.IP AND
+ hosts.IP = disks.IP");
In the end, I want ALL data from hosts, and the relevant data from the other tables.
Once I have the these 3 tables combined, I'd like to print them out in a CSV type format. How do I do that?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.