Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Please anybody convert the following SQL Query to MySql
select convert(int,datepart(hour,Date_Time),108) as FromHour,convert(int,datepart(hour,Date_Time),108)+1 as ToHour,count(convert(varchar(50),datepart(hour,Date_Time),108)) as counts from tbl_Numbers_Temp where Date_Time>=(select convert(varchar,getdate(),23) as Date)group by convert(int,datepart(hour,Date_Time),108) order by FromHour desc
this above query gives bellow output in SQL,,, now i want this above SQL query convert to MySQL query.
FromHour - ToHour -  counts
11     -      12    -   358
 
10     -      11    -   55
 
9      -      10    -   112
 
8      -      9     -   15
 
7      -      8     -   856
 
6      -      7     -   558
 
5      -      6     -   556
 
4      -      5     -   458
 
3      -      4     -   741
 
2      -      3     -   125
 
1      -      2     -   789
 
0      -      1     -   856
Thanks to ALL...
Posted 26-Sep-12 21:40pm
Edited 26-Sep-12 23:24pm
(no name)249.5K
v2
Comments
Malli_S at 27-Sep-12 4:40am
   
What error you are getting? Did you try to run this query on MySQL database?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 27 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100