Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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?

In reply to Re^2: Process and combine two CSV files into one by DrAxeman
in thread Process and combine two CSV files into one by DrAxeman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found