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.
For some reason when I run my query like this below it works fine. But the second way when I add LEFT() or Group by it returns nothing. I don't understand why this is.Thanks,Nick----------------------WORKS------------------------------------Select LRNFROM CDRSWhere (DateTimeInt Between 1257033600 AND 1257119999) AND (OrigGw = 'GB-GW2') AND (OrigPort = '3') AND (RoundDuration > 0)AND (Revenue / RoundDuration *60 = 0.017)Order by LRN----------------DOES NOT WORK---------------------------Select LEFT(LRN,6)FROM CDRSWhere (DateTimeInt Between 1257033600 AND 1257119999) AND (OrigGw = 'GB-GW2') AND (OrigPort = '3') AND (RoundDuration > 0)AND (Revenue / RoundDuration *60 = 0.017)GROUP BY LEFT(LRN,6)Order by LEFT(LRN,6)
Whenever I add anything like that "DISTINCT, LEFT()" I don't get an error, it just wont return any results and it seems to be because of this "(Revenue / RoundDuration *60 = 0.017)" in the where clause. When I remove that, it works but I need that in there