August 27, 2012 at 2:26 am
Actually when i run this on wamp server it shows following error
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CTE1 AS ( SELECT TOP 100 PERCENT DMS_ORG=ISNULL(a.DMS_ORG, b.DMS_Destina' at line 1
August 27, 2012 at 2:29 am
shikhar_0511 (8/27/2012)
Actually when i run this on wamp server it shows following error#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CTE1 AS ( SELECT TOP 100 PERCENT DMS_ORG=ISNULL(a.DMS_ORG, b.DMS_Destina' at line 1
You have posted this to a SQL Server 2008 forum, so naturally the query that I wrote only works there and not in MySQL.
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
August 27, 2012 at 2:31 am
shikhar_0511 (8/27/2012)
Actually when i run this on wamp server it shows following error#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CTE1 AS ( SELECT TOP 100 PERCENT DMS_ORG=ISNULL(a.DMS_ORG, b.DMS_Destina' at line 1
please tell me , you are using Microsoft Sql Server ....:w00t::hehe:
~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one :ermm:
August 27, 2012 at 2:32 am
could you explain the code that starts from
SELECT c.Origin, c.Destination, c.Tonnage
,n=ROW_NUMBER() OVER (ORDER BY (SELECT NULL)
-----------
-----------
till the end
thnx
August 27, 2012 at 2:37 am
shikhar_0511 (8/27/2012)
could you explain the code that starts fromSELECT c.Origin, c.Destination, c.Tonnage
,n=ROW_NUMBER() OVER (ORDER BY (SELECT NULL)
-----------
-----------
till the end
thnx
It assigns a row number to each row of the result of the CROSS APPLY VALUES query.
Not that this will help you much because I have no clue if MySQL has an equivalent.
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
August 27, 2012 at 3:18 am
and what does the cross apply query does ??
August 27, 2012 at 3:20 am
Evaluates the subquery for each row in the outer table. Again, if you're using MySQL no idea what/if the replacement is.
If you are using MySQL, maybe a MySQL forum will help. http://www.dbforums.com has one
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 7 posts - 16 through 21 (of 21 total)
You must be logged in to reply to this topic. Login to reply