Jump to content

Archived

This topic is now archived and is closed to further replies.

shan_cool

Increment count

Recommended Posts

Hi All,

My query
SELECT count(*) as serial no,Lpad(defect_id,5,0) Def_Id,proj_name,prod_name,module_name,mail_id,developer_name,def_severity,def_priority,round,def_status,
def_date,caseno,lead_mail_id,exp_out,actual_out,mod_lead_mail_id FROM dt_defect where def_status <> 'Rejected' order by defect_id";
I want the output

serial no
1
2
3
can any body help me
Thanks
shan

Share this post


Link to post
Share on other sites
order by [b]defect_id[/b]

I think you need to change 'serial no' to serial_no and order by that.

Share this post


Link to post
Share on other sites
First, you may have to backtick a column alias with whitespace; second, why not just order by serial_no?

Share this post


Link to post
Share on other sites
hi,,
thanks for ur prev reply.. but when i give it like

SELECT count(*) as serial_no,Lpad(defect_id,5,0) Def_Id,proj_name,prod_name,module_name,mail_id,developer_name,def_severity,def_priority,round,def_status,
def_date,caseno,lead_mail_id,exp_out,actual_out,mod_lead_mail_id FROM dt_defect where def_status <> 'Rejected' group by defect_id order by serial_no


it shows "1" as serial no for all rows.......

rgds,
shan

Share this post


Link to post
Share on other sites
Perhaps I don't understand -- you're retrieving COUNT(*) as the serial_no? That doesn't make sense -- you'll necessarily get the same result for all rows. Please clarify.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.