This is a multi-part message in MIME format.
------=_NextPart_000_0028_01C8D2AC.7AFFA000
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
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
FROM inventory As i INNER JOIN inventory_flow As if
ON i.item_id = if.item_id
WHERE (if.num_used <> 0 AND if.num_used IS NOT NULL)
AND action_date BETWEEN date '2007-01-01' and date '2008-12-31 23:59'
GROUP BY i.item_name, to_char(if.action_date, 'year'), date_part('year',
if.action_date)
ORDER 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 again...Please
------=_NextPart_000_0028_01C8D2AC.7AFFA000
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Font Definitions */
@[EMAIL PROTECTED]
11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Arial;
color:windowtext;}
@[EMAIL PROTECTED]
Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><span class=3Dpostbody1><font size=3D1 =
face=3DVerdana><span
style=3D'font-size:9.0pt;font-family:Verdana'>Hello All, =
</span></font></span><font
size=3D1 face=3DVerdana><span =
style=3D'font-size:9.0pt;font-family:Verdana'><br>
<span class=3Dpostbody1>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) </span><br>
<span class=3Dpostbody1>SELECT i.item_name::text As row_name,
to_char(if.action_date, 'year')::text As bucket, </span><br>
<span class=3Dpostbody1>SUM(if.num_used)::integer As bucketvalue =
</span><br>
<span class=3Dpostbody1>FROM inventory As i INNER JOIN inventory_flow As =
if </span><br>
<span class=3Dpostbody1>ON i.item_id =3D if.item_id </span><br>
<span class=3Dpostbody1>WHERE (if.num_used <> 0 AND if.num_used IS =
NOT
NULL) </span><br>
<span class=3Dpostbody1>AND action_date BETWEEN date '2007-01-01' and =
date '2008-12-31
23:59' </span><br>
<span class=3Dpostbody1>GROUP BY i.item_name, to_char(if.action_date, =
'year'),
date_part('year', if.action_date) </span><br>
<span class=3Dpostbody1>ORDER BY i.item_name, date_part('year', =
if.action_date); </span><br>
<br>
<span class=3Dpostbody1>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 </span><br>
<br>
<span class=3Dpostbody1>Help again...Please</span></span></font><font =
size=3D2
face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p=
>
</div>
</body>
</html>
------=_NextPart_000_0028_01C8D2AC.7AFFA000--


|