database - converting mssql stored procedure to mysql -
i wanted convert mssql stored procedure mysql stored procedure tried online nothing seems works.
begin --declare @fromdatetime varchar(20), @todatetime varchar(20); select @fromdatetime = '2016-05-18 00:00:00', @todatetime = '2017-05-07 18:00:00'; hourstable (name) ( select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9 union select 10 union select 11 union select 12 union select 13 union select 14 union select 15 union select 16 union select 17 union select 18 union select 19 union select 20 union select 21 union select 22 union select 23 union select 24 ), datatable(hh,sessiones) ( select datepart(hour,convert(datetime2,acctstarttime)),count(*) dbo.radac_1_purpleit acctstarttime >=@fromdatetime , acctstarttime<=@todatetime group datepart(hour,convert(datetime2,acctstarttime)) ) select convert(varchar(20),hourstable.name) name,isnull(datatable.sessiones,0) value hourstable left join datatable on hourstable.name = datatable.hh order hourstable.name end
kindly me solve this
wiki
Comments
Post a Comment