-1

I am trying the below query

select * from (select *,row_number() over(order by salary)r from p ) where r =&n;

I am trying this also where r = 3; I am getting the below error:

Error Code: 1248. Every derived table must have its own alias

Lelio Faieta
  • 6,457
  • 7
  • 40
  • 74
Mounika
  • 15
  • 4
  • Its good to know what you tried and the error you're getting but you'll need to go back and work on your question again. We need more details. Please create a new question. Post sample data and your expected output. See this here: [Tips for asking a good Structured Query Language (SQL) question](https://meta.stackoverflow.com/questions/271055/tips-for-asking-a-good-structured-query-language-sql-question) – griv Sep 07 '22 at 17:52

1 Answers1

0

The error is clear:

Every derived table -> (select *,row_number() over(order by salary)r from p )

Must have its own alias -> (select *,row_number() over(order by salary)r from p) as alias where alias.r = 3

Ross Bush
  • 14,648
  • 2
  • 32
  • 55