SQL Recipes (Beta II)
A FREE cookbook for SQL queries and examples
Register FAQ Search Today's Posts Mark Forums Read

SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.

Go Back   SQL Recipes a FREE cookbook of SQL queries and examples > SQL queries and examples > SQL - Questions and Answers

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
  #1 (permalink)  
Old 01-09-2007, 06:03 PM
Sat
 
Posts: n/a
Default SQL 92 dialect question:

How can I select a Field and then add that field as a column?


I have a table eg

employee type value
001 salary 1500.23
001 expenses 120.00
002 salary 1600.50
003 salary 1600
003 bonus 300

And want the table to look like

Employee salary expenses bonus
001 1500.23 120 0

Any ideas

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Edit/Delete Message Reply With Quote

ANSWER(S):

  #2 (permalink)  
Old 01-12-2007, 02:36 AM
Dimitar
 
Posts: n/a
Default ANY answer. Re: How can I select a Field and then add that field as a column?

Hi Sat,

From a discussion I had with a friend of mine:
What you need is called a pivot table. I do not think it can be achieved with SQL92.
I think however that some database servers have proprietary extensions for this
e.g. the PIVOT statement in SQL 2005 (MS SQL), and I think Oracle also has the functionality.

Dimitar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Edit/Delete Message Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Moderation Tools:


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I make one field be a function of another? stav SQL - Questions and Answers 1 01-23-2007 06:43 PM
How do I insert multiple new records from a web form field into an MS Access database? Sean SQL - Questions and Answers 1 05-26-2006 04:34 AM
How do I ensure that a field in a table must contain values within a specific range? irfanhab SQL - Questions and Answers 1 05-24-2006 03:46 AM
How to impose a check that a certain field can only contain a certain domain of values? irfanhab SQL - Questions and Answers 1 05-24-2006 03:39 AM


All times are GMT. The time now is 09:18 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright (c) 2006-2007 SQL Recipes

1 2 3 4 5 6 7