Re: [GENERAL] Calcuate percentage.

1999-03-09 Thread Sze Yuen Wong


select count(*) into t2 from stations;
FATAL 1:  btree: failed to add item to the right sibling


Any clue?





---Marcin Grondecki  wrote:
>
> select count (*) into t1 from t;
> select count(varl), varl into t2 from t group by varl;
> select varl, (t2.count*100/t1.count) from t2, t1;
> 
> and, of coz, drop tables t1 'n' t2 ;)
> (i don't know it's my laminess, but syntax "select ... into TEMP ddd
... 
> does'n work for me - maybe suggestions? a bug i don't know about?)
> 
> At 06:54 99-03-09 -0800, you wrote:
> >Hi,
> >
> > I need to calcuate the percentage from my table:
> >
> >var1
> >--
> >1
> >1
> >1
> >2
> >2
> >3
> >
> >Desire result:
> >
> >var1 |  percentage
> >
> >1  |50%
> >2  |33%
> >3  |17%
> >
> >===
> >
> >Any clue?
> >
> >Please help.
> >
> >Sze Wong
> >
> >
> >
> >
> >
> >
> >_
> >DO YOU YAHOO!?
> >Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
> >
> Marcin Grondecki
> [EMAIL PROTECTED]
> +48(604)468725
> * I'm not a complete idiot, some parts are missing...
> 
> 
> 

_
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com




Re: [GENERAL] Calcuate percentage.

1999-03-09 Thread Sze Yuen Wong

Can I somehow get the total number of rows in
a function?

if so, then I can say:

select var1, count(*) / numRows() * 100 from table1 group by var1;

Sze Wong



---"K.T."  wrote:
>
> select var1, count(*) from table1 group by var1;
> 
> will get you the count of how many of each number there is...
> 
> I think the only way is to get the max and manually loop thru the
rows and
> calc the percentage.
> 
> -----Original Message-
> From: Sze Yuen Wong <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Date: Tuesday, March 09, 1999 9:48 AM
> Subject: [GENERAL] Calcuate percentage.
> 
> 
> >Hi,
> >
> > I need to calcuate the percentage from my table:
> >
> >var1
> >--
> >1
> >1
> >1
> >2
> >2
> >3
> >
> >Desire result:
> >
> >var1 |  percentage
> >
> >1  |50%
> >2  |33%
> >3  |17%
> >
> >===
> >
> >Any clue?
> >
> >Please help.
> >
> >Sze Wong
> >
> >
> >
> >
> >
> >
> >_
> >DO YOU YAHOO!?
> >Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
> 
> 
> 

_
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com




Re: [GENERAL] Calcuate percentage.

1999-03-09 Thread Sze Yuen Wong

>
> select var1, count(*) from table1 group by var1;
> 
> will get you the count of how many of each number there is...
> 
> I think the only way is to get the max and manually loop thru the
rows and
> calc the percentage.


==>You mean externally using a programming ==>language
==>to do it?




> 
> -----Original Message-
> From: Sze Yuen Wong <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Date: Tuesday, March 09, 1999 9:48 AM
> Subject: [GENERAL] Calcuate percentage.
> 
> 
> >Hi,
> >
> > I need to calcuate the percentage from my table:
> >
> >var1
> >--
> >1
> >1
> >1
> >2
> >2
> >3
> >
> >Desire result:
> >
> >var1 |  percentage
> >
> >1  |50%
> >2  |33%
> >3  |17%
> >
> >===
> >
> >Any clue?
> >
> >Please help.
> >
> >Sze Wong
> >
> >
> >
> >
> >
> >
> >_
> >DO YOU YAHOO!?
> >Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
> 
> 
> 

_
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com




[GENERAL] pgsql crash when selecting a view

1999-03-09 Thread Sze Yuen Wong

Hi,

 Here's what I did to make it crash:

CRATE VIEW tmpView AS
SELECT count(*) FROM myTable;

SELECT * FROM tmpView;

- crash. Every single time.

Anyone knows why and how to make
it work?

Thanks.

Sze Wong




_
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com




[GENERAL] Calcuate percentage.

1999-03-09 Thread Sze Yuen Wong

Hi,

 I need to calcuate the percentage from my table:

var1
--
1
1
1
2
2
3

Desire result:

var1 |  percentage

1  |50%
2  |33%
3  |17%

===

Any clue?

Please help.

Sze Wong






_
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com




[GENERAL] Callable Statement in JDBC

1999-01-08 Thread Sze Yuen Wong

Hi,

 I'm using Postgre in my Java program.
The Java bean (JCDatasource from KL group)
require callable statement when saving to
the DB. But Postgre report Callable statement
is not supported.
 Anybody knows if 6.4 support callable statement?
Or anyother ways to work around?

Thank you very much.

Sze Wong




_
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com