Works in Access but not in SQL

Results 1 to 2 of 2

Thread: Works in Access but not in SQL

  1. #1
    Join Date
    Dec 1969

    Default Works in Access but not in SQL

    OK, I know it&#039;s long and complex, but maybe someone will take pity on me. Trying to convert this to work in MS-SQL:<BR><BR>query="SELECT DISTINCTROW month(modifydate) AS dateMonth, year(modifydate) AS dateyear, Avg([property].[price]) AS avgprice, Avg([property].[totalacres]) AS Avgacres, Avg([price]/[totalacres]) AS avgpperacre, max(price/totalacres) as maxprice, min(price/totalacres) as minprice, Count([price]/[totalacres]) AS countprop, avg(price/totalacres)/4202 AS priceindex FROM property WHERE ((([property].[price])&#060;10000000 And ([property].[price])&#062;100) And (([property].[totalacres])&#062;1) AND (price/totalacres)&#060;25000 AND (price/totalacres)&#062;5 And ((Year(modifydate))&#062;1998)) GROUP BY month(modifydate), year(modifydate), Year([property].[modifydate])*12+DatePart(&#039;m&#039;,[property].[modifydate])-1 ORDER BY year(modifydate), month(modifydate)"<BR><BR>This last part:<BR><BR>Year([property].[modifydate])*12+DatePart(&#039;m&#039;,[property].[modifydate])-1 ORDER BY year(modifydate), <BR><BR>seems to be the problem...I barely understand it myself, it came from the create query wizard to groups the data by months.

  2. #2
    Join Date
    Dec 1969

    Default can u...

    take of all "[" and "]" and then show the query? and again it is "distinct" and not "distinctrow"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts