Click here to Skip to main content
15,898,134 members

Comments by ali from hyd (Top 12 by date)

ali from hyd 18-Jul-13 1:50am View    
nice thank u
ali from hyd 18-Jul-13 0:54am View    
i have to display the Ticket which is in Replied Status first
Open Status second
Reopen Status Third
Closed Status Fourth
ali from hyd 18-Jul-13 0:36am View    
for my ticketing functionality i am having status as 1-Open ,2-Reply , 3-Closed ,4-Reopen.

in grid i want to display the records it in the following order 2,1,4,3
ali from hyd 15-May-13 1:02am View    
i written the following procedure and i am getting only one type of time only ie., By selecting min time or max time.

i want to concatenate both min time and max time with comma seperated

use ecampus;
DELIMITER $$
DROP PROCEDURE IF EXISTS `GetTimeByDate` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetTimeByDate`(in sdate date)
BEGIN
declare finish int default 0;
declare cdate date;
declare str varchar(10000) default "select RF_Code,";

declare curs cursor for select Date from ecampus.log where (month(Date)=month(sdate) AND YEAR(Date)=YEAR(sdate)) group by Date;
declare continue handler for not found set finish = 1;
open curs;
my_loop:loop
fetch curs into cdate;
if finish = 1 then
leave my_loop;
end if;
set str = concat(str, "min(case when Date = '",cdate,"' then Time else null end) as `",cdate,"`,");
end loop;
close curs;
set str = substr(str,1,char_length(str)-1);

set @str = concat(str," from ecampus.log
group by RF_Code");

prepare stmt from @str;
execute stmt;
deallocate prepare stmt;
END $$

DELIMITER ;


i am getting output as below:

RF_Code 2013-01-01 2013-01-02
104 09:00:00 09:02:00
105 09:30:00 null


required output is:

RF_Code 2013-01-01 2013-01-02
104 09:00:00,18:12:00 09:02:00,19:05:00
105 09:30:00,18:30:00 null,null
ali from hyd 15-May-13 0:47am View    
i written the following procedure and i am getting only one type of time only ie., By selecting min time or max time.

i want to concatenate both min time and max time with comma seperated

use ecampus;
DELIMITER $$
DROP PROCEDURE IF EXISTS `GetTimeByDate` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetTimeByDate`(in sdate date)
BEGIN
declare finish int default 0;
declare cdate date;
declare str varchar(10000) default "select RF_Code,";

declare curs cursor for select Date from ecampus.log where (month(Date)=month(sdate) AND YEAR(Date)=YEAR(sdate)) group by Date;
declare continue handler for not found set finish = 1;
open curs;
my_loop:loop
fetch curs into cdate;
if finish = 1 then
leave my_loop;
end if;
set str = concat(str, "min(case when Date = '",cdate,"' then Time else null end) as `",cdate,"`,");
end loop;
close curs;
set str = substr(str,1,char_length(str)-1);

set @str = concat(str," from ecampus.log
group by RF_Code");

prepare stmt from @str;
execute stmt;
deallocate prepare stmt;
END $$

DELIMITER ;


i am getting output as below:

RF_Code 2013-01-01 2013-01-02
104 09:00:00 09:02:00
105 09:30:00 null


required output is:

RF_Code 2013-01-01 2013-01-02
104 09:00:00,18:12:00 09:02:00,19:05:00
105 09:30:00,18:30:00 null,null