Announcement

Collapse
No announcement yet.

Query, stuck, anyone help?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Query, stuck, anyone help?

    Error : ERROR: syntax error at or near "ORDER"

    LINE 4: ORDER BY ( acc.Location_Easting_OSGR - Sites.SITE_ETG )...



    WITH SITESmin as (
    SELECT public.acc.Location_Easting_OSGR, public.acc.Location_Northing_OSGR
    FROM acc Sites ,
    ORDER BY ( acc.Location_Easting_OSGR - Sites.SITE_ETG ) * ( acc.Location_Easting_OSGR - Sites.SITE_ETG ) + (acc.Location_Northing_OSGR - "public"."Sites"."SITE_ETG" ) * ( acc.Location_Northing_OSGR - "public"."Sites"."SITE_NTG" )
    LIMIT 1
    )
    UPDATE ACC
    SET acc.Location_Easting_OSGR = SITESmin.acc.Location_Easting_OSGR,
    acc.Location_Northing_OSGR = SITESmin.acc.Location_Northing_OSGR
    FROM SITESmin;



    Novice here.

    how do I stop my email address being published?!!
    Last edited by anthonyfca; 03-16-2017, 09:29 PM.

  • #2
    Please try to remove the comma between FROM and ORDER BY to see if it can solve your problem.

    Comment


    • #3
      then I get this error:

      Error : ERROR: invalid reference to FROM-clause entry for table "acc"

      LINE 2: SELECT public.acc.Location_Easting_OSGR, public.acc.Location...

      ^

      HINT: Perhaps you meant to reference the table alias "sites".


      I am getting nothing but errors with every thing I try, maybe I should ask for help with the problem instead of the solution?

      Comment

      Working...
      X