Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi Monks, in my current program I have a routine that retrieves results from my database. Currently I display the results from each statment in the following form.

Result 1; R1something1 ; R1something2 ; R1something5 ; R1something6 ; R1something7 ; R1something8 ; Result2; R2something1 ; R2something2 ; R2something3 ; R2something4 ; R2something5 ; R2something6 ; R2something7 ; R2something8 ; R2something9 ; R2something 10;

But I want to display them beside each other to aid with comparisons. Like so:

Result 1 Result2 R1something1 ; R1something2 ; R2something1 ; R2something2 ; -- ; -- ; R2something3 ; R2something4 ; R1something5 ; R1something6 ; R2something5 ; R2something6 ; R1something7 ; R1something8 ; R2something7 ; R2something8 ; -- ; -- ; R2something9 ; R2something10;

I also need to know how I would substitute a null value with a "--" in my output file as I want the results that satisfy the same conditions beside each other and the results with no corresponding results in the other table should still be displayed i.e. R2Something 9 & 10 above.
I am retrieving results row by row. But I am unsure of how to switch between the statements. Will I have to retrieve all results for one sql statement and then begin the second? Or can I switch between the two? Or is there some funky perl module that can take care of this for me?
Any help you can give is appreciated
Thanks Monks


Sum day soon I'Il lern how 2 spelI (r tYpe)

In reply to Merging SQL Results by johnirl

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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-05-29 23:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found