Click here to Skip to main content
15,742,619 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two tables in Oracle, EmployeeMaster and EmployeeMarks,

i want to write SQl query for get result like below snap shot,


What I have tried:

i have done with sub query but does not work
Updated 3-Mar-17 17:35pm

It's time to learn how do joins work, see, for instance: Oracle / PLSQL: Joins[^].
Share this answer
You can do it in plain SQL (PL/SQL not really required). Correction (if any) to the following query would be minimal and you should be able to handle it yourself!
ROW_NUMBER() is one of the analytic functions (like sum(..) over, rank() over, dense_rank() over etc) and not too difficult - the time invested in learning is well worth the effort.

select case slno when 1 then name else '' end name, case slno when 1 then to_char(age) else '' end age, marks
select name, age, marks, emp_id, row_number() over (partition by emp_id order by mark_id) slno
select employeename name, emp_id, age, mark_id, marks
from employeemaster a, employeemarks b
where = employeemasterid
order by emp_id, slno
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900