How do you set the order by command?

Asked

Viewed 257 times

0

I typed the following command in the oracle;

select * from emp where ndep in(10,30);

and had it as a result;

inserir a descrição da imagem aqui

he’s all right, the problem is I wanted to put him in the descending order of the department number;

these were my attempts;

first attempt;

select * from emp where ndep in(10,30) | order by ndep desc;

attempt number two

select * from emp where ndep in(10,30)  order by ndep desc;

attempt 3

select * from emp where ndep in(10,30) and  order by ndep desc;

I was unsuccessful.

How do I hit the remote?

///////////////////////updating the post

select * from emp
where ndep in(10,30) 
and  
order by ndep desc;

that was the error message;

ORA-00936: expression not found 00936. 00000 - "Missing Expression" *Cause:
*Action: Line error: 3 Column: 5

  • 1

    The ndep desc resulted in what? Deviria works, what went wrong?

  • just updated the post, take a look.

1 answer

1


Takes the and

Stay like this:

select * from emp
where ndep in(10,30) 
order by ndep desc;

Fiddle with SQL running here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.