Thread: hi
<div class="Section1"><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font color="black"face="Times New Roman" size="3"><span style="font-size:12.0pt; color:black">Hi </span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font color="black"face="Times New Roman" size="3"><span style="font-size:12.0pt; color:black">I have the data like this in <b><span style="font-weight:bold">temp</span></b> table</span></font><p class="MsoNormal"style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font color="black" face="Times New Roman" size="3"><spanstyle="font-size:12.0pt; color:black">SQL> Select sno, value from temp;</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><fontcolor="black" face="Times New Roman" size="3"><span style="font-size:12.0pt; color:black;font-weight:bold">SNO Value</span></font></b><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">1 650.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">2 850.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">3 640.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">3 985.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">5 987.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">9 9864.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">7 875.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><fontcolor="black" face="Times New Roman" size="3"><span style="font-size:12.0pt; color:black">Now, I want display the result like this…</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><fontcolor="black" face="Times New Roman" size="3"><span style="font-size:12.0pt; color:black">SQL> Select sno, value, </span></font><font color="red"><span style="color:red">get_sum(value)</span></font><fontcolor="black"><span style="color:black"> as sum from temp;</span></font><pclass="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><font color="black"face="Times New Roman" size="3"><span style="font-size:12.0pt; color:black;font-weight:bold"> SNO Value SUM</span></font></b><p class="MsoNormal"style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">1 650.00 650.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">2 850.00 1500.00 --650+850</span></font><pclass="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">3 640.00 2140.00 --1500+640</span></font><pclass="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">3 985.00 3125.00 -- 2140+985</span></font><pclass="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">5 987.00 4112.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">9 9864.00 13976.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">7 875.00 14851.00</span></font><p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black"> </span></font><pclass="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; margin-left:75.0pt"><font color="black" face="Times New Roman" size="3"><span style="font-size:12.0pt;color:black">Any onecan tell me query for this .. I don’t want any procedure or function…</span></font><p class="MsoNormal"><font face="Arial"size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><strong><b><font face="Monotype Corsiva" size="3"><span style="font-size:12.0pt;font-family:"MonotypeCorsiva"">Thanks & Regards</span></font></b></strong><p class="MsoNormal"><strong><b><fontface="Monotype Corsiva" size="3"><span style="font-size:12.0pt;font-family:"Monotype Corsiva"">PenchalReddy</span></font></b></strong><p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12.0pt"> </span></font></div><table><tr><td bgcolor="#ffffff"><font color="#000000">Information transmitted by this e-mailis proprietary to Infinite Computer Solutions and / or its Customers and is intended for use only by the individualor the entity to which it is addressed, and may contain information that is privileged, confidential or exemptfrom disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwardedto you without proper authority, you are notified that any use or dissemination of this information in any manneris strictly prohibited. In such cases, please notify us immediately at info.in@infics.com and delete this email fromyour records.<br /></font></td></tr></table>
Select sno AS “SNO”,
SELECT value AS “VALUE”,
get_sum(value) as SUM
from temp;
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Penchalaiah P.
Sent: April 24, 2007 8:09 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] hi
Hi
I have the data like this in temp table
SQL> Select sno, value from temp;
SNO Value
1 650.00
2 850.00
3 640.00
3 985.00
5 987.00
9 9864.00
7 875.00
Now, I want display the result like this…
SQL> Select sno, value, get_sum(value) as sum from temp;
SNO Value SUM
1 650.00 650.00
2 850.00 1500.00 --650+850
3 640.00 2140.00 --1500+640
3 985.00 3125.00 -- 2140+985
5 987.00 4112.00
9 9864.00 13976.00
7 875.00 14851.00
Any one can tell me query for this .. I don’t want any procedure or function…
Thanks & Regards
Penchal Reddy
Information transmitted by this e-mail is proprietary to Infinite Computer Solutions and / or its Customers and is intended for use only by the individual or the entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at info.in@infics.com and delete this email from your records. |
Hi,try this. It's working... SELECT t1.sno, sum(t2.value) FROM temp as t1, temp as t2 WHERE t1.sno >= t2.sno GROUP BY t1.sno; but not completely. The problem is the this suppose your sno is uniqu. But as I see 3 is not. Anyway it may help you. >I have the data like this in temp table > >SQL> Select sno, value from temp; > >SNO Value > >1 650.00 > >2 850.00 > >3 640.00 > >3 985.00 > >5 987.00 > >9 9864.00 > >7 875.00 > >Now, I want display the result like this... > >SQL> Select sno, value, get_sum(value) as sum from temp; > > SNO Value SUM > >1 650.00 650.00 > >2 850.00 1500.00 --650+850 > >3 640.00 2140.00 --1500+640 > >3 985.00 3125.00 -- 2140+985 > >5 987.00 4112.00 > >9 9864.00 13976.00 > >7 875.00 14851.00 > > > >Any one can tell me query for this .. I don't want any procedure or >function... > > > > > >Thanks & Regards > >Penchal Reddy > > > > > >Information transmitted by this e-mail is proprietary to Infinite Computer Solutions and / or its Customers and is intended for use only by the individual or the entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at info.in@infics.com and delete this email from your records. >
On þri, 2007-04-24 at 17:39 +0530, Penchalaiah P. wrote: > Hi > > I have the data like this in temp table > > SQL> Select sno, value from temp; you seem to be assuming a specific order for this. gnari
On Tue, 24 Apr 2007, Penchalaiah P. wrote: > Hi > > I have the data like this in temp table > > SQL> Select sno, value from temp; > > SNO Value > > 1 650.00 > > 2 850.00 > > 3 640.00 > > 3 985.00 > > 5 987.00 > > 9 9864.00 > > 7 875.00 Tables are not ordered. You'll need something like an ordering column that represents the ordering and is unique. Then you can probably do something like (untested):select sno, value, (select sum(value) as sum from temp t where t.ordering<=temp.ordering) from temp order by ordering; orselect t1.sno, t1.value, sum(t2.value) from temp as t1, temp as t2 wheret1.ordering >= t2.ordering group by t1.ordering,t1.sno, t1.value orderby t1.ordering;
Hi,
Can i get GUI tool for PostgreSQLin LINUX.Pls let me know from wher i candownload the same.
Regards
SAJI VERGHESE
+919941140433
From: "Wilkinson, Jim" <Jim.Wilkinson@cra-arc.gc.ca>
To: Penchalaiah P. <penchalaiahp@infics.com>; pgsql-sql@postgresql.org
Sent: Tuesday, 24 April, 2007 6:15:13 PM
Subject: Re: [SQL] hi
Select sno AS “SNO”,
SELECT value AS “VALUE”,
get_sum(value) as SUM
from temp;
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Penchalaiah P.
Sent: April 24, 2007 8:09 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] hi
Hi
I have the data like this in temp table
SQL> Select sno, value from temp;
SNO Value
1 650.00
2 850.00
3 640.00
3 985.00
5 987.00
9 9864.00
7 875.00
Now, I want display the result like this…
SQL> Select sno, value, get_sum(value) as sum from temp;
SNO Value SUM
1 650.00 650.00
2 850.00 1500.00 --650+850
3 640.00 2140.00 --1500+640
3 985.00 3125.00 -- 2140+985
5 987.00 4112.00
9 9864.00 13976.00
7 875.00 14851.00
Any one can tell me query for this .. I don’t want any procedure or function…
Thanks & Regards
Penchal Reddy
Information transmitted by this e-mail is proprietary to Infinite Computer Solutions and / or its Customers and is intended for use only by the individual or the entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at info.in@infics.com and delete this email from your records. |
SHOUT IT OUT! Tell everyone, from anywhere, that you're online on Yahoo! Messenger
Try pgAdmin - Google will find it for you.<br /><br /> ~p<br /><br /> On Wed, 2007-04-25 at 10:10 +0530, saji varghese wrote:<br /><blockquote type="CITE"><font color="#000000">Hi,</font><br /><font color="#000000">Can i get GUI tool for PostgreSQLinLINUX.Pls let me know from wher i candownload the same.</font></blockquote><br /><br /><br /><p><b>*******************Confidentialityand Privilege Notice*******************</b><p> The material contained in this messageis privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsiblefor delivery of the message to such person, you may not copy or deliver this message to anyone, and you shoulddestroy it and kindly notify the sender by reply email. <p> Information in this message that does not relate to theofficial business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees,contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmissionof this message or any attachments <br />
Penchalaiah P. wrote: > Information transmitted by this e-mail is proprietary to Infinite Computer Solutions It may be proprietary, but it shore ain't confidential!
John Summerfield wrote: > Penchalaiah P. wrote: > >> Information transmitted by this e-mail is proprietary to Infinite >> Computer Solutions > > It may be proprietary, but it shore ain't confidential! Placing "confidential" on every document without regard for its content, especially when some of it's publicly disseminated, can remove the protection of confidentiality at law from all such marked documents in many jurisdictions, including the U.S. There must be discrimination applied in the marking of information as "confidential". Quite aside from the foolishness you pointed out of marking something "confidential" then placing it into the public eye in an archived forum where it will be visible by everybody forever. Now we can publish everything ever written at or by Infinite Computer Solutions without fear of liability. -- Lew