Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQL question?

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic