This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
    Bookmark Topic Watch Topic
  • New Topic

SQL question?

 
George Liao
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

I have a staff table like this:

name year salary
============================
a 1998 50
a 1999 100
a 2000 200
a 2001 300
b 2000 200
b 2001 300


I want to get a new table from the above table:

name salary(1998) salary(1999) salary(2000) salary(2001)
===================================================================
a 50 100 200 300
b 0 0 200 300


What's the SQL for this problem? I will invoke the sql code in my java code.
Thanks.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33670
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
George,
Sushil posted the exact same question. I'm closing this (I picked one randomly) so that all the discussion can continue in one place.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic