5

I have looked through this site and cannot find a similar scenario. I am trying to run the following code

SELECT st.storeid, s.noofitems
FROM salestrnsaction AS st, soldvia AS s
WHERE st.tid = s.tid
ORDER BY noofitems ASC;

and am still receiving the 'SQL command not properly ended' error.

More specifically, this is the message I am receiving.

SELECT st.storeid, s.noofitems
FROM salestrnsaction AS st, soldvia AS s
WHERE st.tid = s.tid
ORDER BY noofitems ASC
Error at Command Line : 287 Column : 22
Error report -
SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 -  "SQL command not properly ended"
*Cause:    
*Action:

Thanks.

0

2 Answers 2

10

You are using ORACLE right?Using AS in alias in FROM Clause is not valid in Oracle. Please refrain from using AS in giving aliases to tables.

Just write the alias after the table.

SELECT st.storeid, s.noofitems
FROM salestrnsaction st, soldvia s
WHERE st.tid = s.tid
ORDER BY s.noofitems ASC;
Sign up to request clarification or add additional context in comments.

5 Comments

Perfect! Thank you. We haven't covered aliases yet, so I was going off of what I could find online. This worked. Appreciate the help all.
Np.If it works, please mark it as the correct answer.Thanks
Do we need to mandatorly use aliasin order by? @brenners1302
yes.so it wouldnt be ambigous if the column exist in both tables.
This was my problem, stupid oracle.
0

My issue was a little bit different. I was just performing a simple SELECT and got the same error.

SELECT *
-- Inventory
FROM EQUIPMENT as EQP

What I discovered from the research I did is the AS is not needed for Oracle SQL vs MySQL, so when I changed to the query to...

SELECT *
-- Inventory
FROM EQUIPMENT EQP

this eliminated the error.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.