Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hello,I have to gotFebruary 2009January 2009 & Date With Desc But there is problem withPlease Anyone HelpSELECT iNewsId ,DATE_FORMAT(dDate,'%M %Y') as month_yy FROM news WHERE eStatus = 'Active' GROUP BY month_yy ORDER BY dDate DESCI got the approximete result but not get iNewsId According to Date Desc.
SwePeso
Patron Saint of Lost Yaks
30421 Posts
Posted - 2009-01-21 : 16:40:51
You are GROUPing by dDate so what do you want to do with iNewsID column?There must be some kind of aggregation involved.E 12°55'05.63"N 56°04'39.26"
what is your expected output?E 12°55'05.63"N 56°04'39.26"
matru
Starting Member
4 Posts
Posted - 2009-01-21 : 18:44:39
Please Run this query belowSELECT dDate FROM news WHERE eStatus = 'Active' GROUP BY DATE_FORMAT(dDate,'%y %m') ORDER BY dDate DESCI got Wrong value.Please Suggrst.
SwePeso
Patron Saint of Lost Yaks
30421 Posts
Posted - 2009-01-21 : 18:53:49
What. Is. Your. Expected. Output. From. The. Sample. Data. I. Provided. In. My. Previous. Post?I. Can't. Access. Your. Database. So. We. Have. To. Use. Sample. Data. Instead.E 12°55'05.63"N 56°04'39.26"