shan_cool Posted January 30, 2006 Share Posted January 30, 2006 Hi All,My querySELECT 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 outputserial no123can any body help meThanksshan Quote Link to comment https://forums.phpfreaks.com/topic/3283-increment-count/ Share on other sites More sharing options...
AndyB Posted January 30, 2006 Share Posted January 30, 2006 order by [b]defect_id[/b]I think you need to change 'serial no' to serial_no and order by that. Quote Link to comment https://forums.phpfreaks.com/topic/3283-increment-count/#findComment-11196 Share on other sites More sharing options...
fenway Posted January 30, 2006 Share Posted January 30, 2006 First, you may have to backtick a column alias with whitespace; second, why not just order by serial_no? Quote Link to comment https://forums.phpfreaks.com/topic/3283-increment-count/#findComment-11202 Share on other sites More sharing options...
shan_cool Posted January 31, 2006 Author Share Posted January 31, 2006 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_noit shows "1" as serial no for all rows.......rgds,shan Quote Link to comment https://forums.phpfreaks.com/topic/3283-increment-count/#findComment-11217 Share on other sites More sharing options...
fenway Posted January 31, 2006 Share Posted January 31, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/3283-increment-count/#findComment-11219 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.