Re: Reversing the output of a query
Hey Fabrizio,
The issue is with how you're using single quotes around 'index'. In SQL, single quotes are used for strings, not for column names. So, when you put 'index' in quotes, SQL treats it as a string rather than a column, which messes up the sorting.
Just drop the quotes around index and you're good to go. Here's the corrected query:
sql
SELECT *, ( 3959 * acos ( cos ( radians(38.764104) ) * cos( radians(latitude ) ) * cos( radians(longitude ) - radians(16.199104) ) + sin ( radians(38.764104) ) * sin( radians(latitude ) ) ) ) AS distance
FROM banner
HAVING distance < 0.3
ORDER BY index ASC;
That should fix the ordering issue. If index is a reserved word in your database, you can wrap it in backticks like this: `index`.
Subject
Written By
Posted
September 09, 2024 10:58AM
Re: Reversing the output of a query
September 26, 2024 01:22AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.