Re: Playing w/queries
- From: "Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@xxxxxxxxxx>
- Date: Thu, 11 Jan 2007 07:40:51 +0100
You need pivot queries. In SQL2005, you have PIVOT operator. In SQL 2000 and
earslier, you can help yourself with CASE clause. Check, for example,
http://www.sqlservercentral.com/columnists/plarsson/pivottableformicrosoftsqlserver.asp
for both solutions.
--
Dejan Sarka
http://www.solidqualitylearning.com/blogs/
"Ron" <nospam@xxxxxxxxx> wrote in message
news:Onjc4qQNHHA.1872@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
Have a complex (for me) query which combines several subqueries and tables
to get the following information:
Agent_ID, Agent_Name, (and their expenses) Transportation, Salary, Meals..
(and their incomes) Commissions, bonus,..and dates.
I'd like to create an output where vertically will list the agents' names
and horizontally their expenses and incomes ordered by month.
Something like:
January February
Transportation, Salary. Transportation, Salary.
Agente_Name: 120 1200 100 1200
Not sure if it's possible but I thought to ask.
TIA
Ron
SQL2k
--------------------------------------------------------------------------------
Estoy utilizando la versión gratuita de SPAMfighter para usuarios
privados.
Ha eliminado 1696 correos spam hasta la fecha.
Los abonados no tienen este mensaje en sus correos.
¡Pruebe SPAMfighter gratis ya!
.
- References:
- Playing w/queries
- From: Ron
- Playing w/queries
- Prev by Date: Playing w/queries
- Next by Date: Re: Display results
- Previous by thread: Playing w/queries
- Next by thread: Re: Display results
- Index(es):
Loading