Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Please anybody convert the following SQL Query to MySql
SQL
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
Updated 26-Sep-12 22:24pm
v2
Comments
Malli_S 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900