Home » SQL & PL/SQL » SQL & PL/SQL » group by (merged)
group by (merged) [message #321173] Mon, 19 May 2008 06:00 Go to next message
varosh81
Messages: 178
Registered: February 2008
Location: CHENNAI
Senior Member
I HAVE ONE TABLE, COLUMNS LIKE
APPLICANT_ID,
YEAR OF EXPERIENCE
TOTAL YEAR OF EXPERIENCE
COMPANY.
AND SAME APPLICANT ID HAVE DIFFERENT EXPERIENCE IN DIFFERNT COMPANIES.

SAMPLE DATA

APPLICANT ID / YEAR OF EXPERIENCE / COMPANY

3001 / 2YEAR 1 MONTHS / STERLITE
3001 / 1YEAR 5 MONTHS / ELNET
3001 / 1 YEAR 5 MONTHS / SPIC
3002 / 2 YEAR 2 MONTHS / DCW
3002 / 1 YEAR 7 MONTHS / VERIZON

I WANT OUTPUT WILL COME THIS FORMAT
APPLICANT ID TOTAL YEAR OF EXPERIENCE
3001 4YEARS 11 MONTS
3002 3 YEARS 9 MONTHS

[Updated on: Mon, 19 May 2008 06:06]

Report message to a moderator

Re: group by [message #321174 is a reply to message #321173] Mon, 19 May 2008 06:05 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1/ DON'T POST IN UPPER CASE
2/ please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
3/ Always post your Oracle version (4 decimals).
4/ Post a test case: create table and insert statements. Also post the result you want with these data.
5/ 1 YEAR = 12 MONTHS

Regards
Michel

[Updated on: Mon, 19 May 2008 06:06]

Report message to a moderator

GROUP BY [message #321177 is a reply to message #321173] Mon, 19 May 2008 06:11 Go to previous messageGo to next message
varosh81
Messages: 178
Registered: February 2008
Location: CHENNAI
Senior Member
i have one table, columns like year of experience,applicant_id,company.and same applicant id have different experience in differnt companies.

sample data

applicant id year of experience company

3001 2year 1 months sterlite
3001 1year 5 months elnet
3001 1 year 5 months spic
3002 2 year 2 months dcw
3002 1 year 7 months verizon

i want output will come this format
applicant id / year of experience
3001 / 4years 11 monts
3002 / 3 years 9 months

[Updated on: Mon, 19 May 2008 06:12]

Report message to a moderator

Re: GROUP BY [message #321186 is a reply to message #321177] Mon, 19 May 2008 06:33 Go to previous message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Michel Cadot wrote on Mon, 19 May 2008 13:05
1/ DON'T POST IN UPPER CASE INCLUDING THE TITLE
2/ please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
3/ Always post your Oracle version (4 decimals).
4/ Post a test case: create table and insert statements. Also post the result you want with these data.
5/ 1 YEAR = 12 MONTHS

Regards
Michel


Previous Topic: view needed on the derived column
Next Topic: data encryption and decryption
Goto Forum:
  


Current Time: Wed Dec 07 09:09:10 CST 2016

Total time taken to generate the page: 0.17691 seconds