Databases
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives Mailing Lists Databases

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old June 20th, 2008, 08:31 AM
Chris Preston
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Cross Tab Functions

Hello All,
I have used the cross tab function to setup tables that display months'
data, however i need to display years data instead of the months so i
would display 2006 as a column, 2007 as a colum and 2008 as a column. when i
tried to modify the simple example of the cross tab (shown below)
SELECT i.item_name::text As row_name, to_char(if.action_date, 'year')::text
As bucket,
SUM(if.num_used)::integer As bucketvalue
FRM inventory As i INNER JIN inventory_flow As if
N i.item_id = if.item_id
WHERE (if.num_used <0 AND if.num_used IS NT NULL)
AND action_date BETWEEN date '2007-01-01' and date '2008-12-31 23:59'
GRUP BY i.item_name, to_char(if.action_date, 'year'), date_part('year',
if.action_date)
RDER BY i.item_name, date_part('year', if.action_date);

basically i changed the mon and the month to be year the system displayed
something that i am not sure about. is there a command that converts the
year similar to the mon

Help againPlease

Reply With Quote
Reply

Viewing: Web Development Archives Mailing Lists Databases > Cross Tab Functions


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT