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??

That returns 1 record (and same if I correct @rownum to @row_num)

queue_name jobs_pend jobs_run
others           471      457

If I run the sub-select without the CASE like this

SELECT @row_num, queue_name, jobs_pend, jobs_run FROM ( SELECT @row_num := @row_num + 1, queue_name, jobs_pend, jobs_run FROM queues, (SELECT @row_num := 0) r ) q

it returns

@row_num  queue_name  jobs_pend jobs_run
20        adice_long          5       39
20        adice_ncsim         0        6
20        adice_short       254      192
20        calibre             0        0
20        dsp_ncsim_gls       0        2
20        dsp_ncsim_hp        0        2
20        dsp_ncsim_lp        0        5
20        dsp_ncsim_mp        0        5
20        hcg_ncsim_comp      0        0
20        hcg_ncsim_hp        0        9
20        hcg_ncsim_lp        0        0
20        hcg_ncsim_mp        0        0
20        hcg_ncsim_short     0        0
20        ipdc_pte            0        0
20        ncsim_long         41       78
20        ncsim_lp            1        4
20        ncsim_short         0       84
20        normal            170       30
20        spectreRF           0        1
20        vcs                 0        0
poj

In reply to Re^7: How to add columns with new row name using perl from mysql query? by poj
in thread How to add columns with new row name using perl from mysql query? by perlanswers

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 chanting in the Monastery: (7)
As of 2024-04-19 10:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found