Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Unanswered: Query Syntax Error in Expression . . .

    From This Site . . .

    Code:
    http://blogannath.blogspot.com/2010/03/microsoft-access-tips-tricks-statistics.html
    Syntax error in this expression highlighted this . . .

    Code:
    (select max(SalePrice) from 1stHalf2013 where 1stHalf2013.SalePrice in (select top 50 percent SalePrice from 1stHalf2013 where 1stHalf2013.SalePrice = T.City, T.Dte, order by SalePrice))
    I'm dumbfounded!

    Ideas . . . Rick

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Im not that dumfounded as
    Code:
    where 1stHalf2013.SalePrice = T.City, T.Dte
    isn't valid SQL
    when you cut and paste code and or SQL from sources you need to understand what the code does AND make certain that when you paste it you translate the stuff that is releavnt to your use from the posted example

    how do you expect to match a saleprice (presumably numeric) with a city, let alone city,dte?

    What is t.city and t.dte?
    What table alias (the t. Bit) is defined as t?
    What are you actually trying to achieve? (in English)
    Last edited by healdem; 07-29-13 at 10:39.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Median GROUP BY Query

    SalePrice is the numeric field, GROUP BY City and Dte

    Here is the Query . . .

    Code:
    SELECT T.groupField, (select max(myField) from myTable where myTable.myField in (select top 50 percent myField from myTable where myTable.groupField = T.groupField order by myField)) AS Median FROM myTable AS T group by T.groupField
    Here is the site I where I found it . . .

    Microsoft Access Tips & Tricks: Statistics With Grouping | The Blogannath Rolls On . . ..

    Thanks . . . Rick

Posting Permissions

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