On Wed, 10 Mar 1999, Rodney McDuff wrote:
Those do two different things. If you always plan using doing
lookups on both of those columns at the same time, it only makes sense to
do one index with both. If you rarely do, but do lots of lookups using
either, then do more than one index.
Hi
When you have a table with multiple columns and you want indexes on
them you can either
(a) create index table_idx on table using btree ( col1, col2, ..., col7);
or
(b) create index table_col1_idx on table using btree ( col1 );
create index table_col2_idx on table using btree (
Hi.
I am having a problem
I have looked at manpages, I have gone through the mailing list
archives and faq and looked at all the documentation that exists, and
have no solution.
I am trying to create a database.
I have created it before, so I destroydb, then createdb
I have a script to create
It's crude and not very efficient, but here is a solution:
CREATE TABLE temp ( var INT2 );
INSERT INTO temp VALUES (1);
etc.
CREATE FUNCTION temp_row_count() RETURNS FLOAT AS
'SELECT COUNT(*)::FLOAT AS result FROM temp'
LANGUAGE 'sql';
SELECT var, COUNT(*)::FLOAT / temp_row_count() AS pct
FROM
> Can I somehow get the total number of rows in
> a function?
create function numRows() returns int4
as 'select count(*) from '
language 'sql';
> select var1, count(*) / numRows() * 100 from table1 group by var1;
maybe this is better
select var1, (count(*) * 100) / numRows() from tab
As I tried to make a function for this percent calculation I fell over
the problem of passing a table to the function. I'd like to make this
function:
create function NumRows(table) returns int4
as 'select count(*) from $1'
language 'sql';
Is this possible?
Dear Postgres Users,
I am new to Postgres. I succeded to install Postgres on my Linux -PC. It
is working and
I learning a lot from the html documentations.
However I did not find exemples or a samples of databas, query
with the distribution I have (6.4.2)
In the tutorial they said that I wil
hey all!
I want to use a "LIKE" comparison in my plpgsql script, but I'm unsure how to
do it... What I have right now doesn't work as hoped (although I did expect it
to not work).
UPDATE dir SET udate = curtime WHERE ''bind_dir.dir''::text LIKE ''%mydir%''::text AND
dir.uid = bind_dir.u
On Tue, 9 Mar 1999, Marcin Grondecki wrote:
# There is better answer, i think. Simply read smth about cursors -
# declaring, using, droping. I think this is what u need. In case of
# troubles with understanding, i'd serve with some examples in Perl.
If it's the exact last input row you
On Tue, 9 Mar 1999, amarof wrote:
# please give me the way to do that
Nobody knows what your server is.
--
SA, beyond.com My girlfriend asked me which one I like better.
pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <[EMAIL PROTECTED]>
|Key fingerprint = 87 02 57 08 02 D0
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,
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
On Tue, 9 Mar 1999, amarof wrote:
> please give me the way to do that
> all thanx
It would help a little if you mentioned what you are running PostgreSQL
on. Different systems have different kinds of startup scripts.
Brett W. McCoy
http://ww
At 15:20 99-03-09 +, you wrote:
>> I am developing a database with PostgreSQL in Linux, and using ecpg to
>> write the C program to communicate with the database.
>> One of my application need to get the data from the last row in a
>> table. Is there any function or command that can tract wh
please give me the way to do that
all thanx
:-))
How about...
select field1 where primary_key = select max(primary_key) from table;
or something like that :) I always mess up the parenthesis...cant remember
whether or not they are needed here around the second select.
-Original Message-
From: hoelc <[EMAIL PROTECTED]>
To: [EMAIL PROT
Hi!
Have you run locale test (.../src/test/locale)?
On Mon, 8 Mar 1999, Vadim Valiakhmetov wrote:
> I have encountered strange behaviour of Postgresql-6.4.2 server
> (installed on FreeBSD3.0 from distributive) when I was trying to do
> case-insensitive search in simplest text table (without i
Does anyone have a query or function that will return the size (in bytes) of
a table?
> I am developing a database with PostgreSQL in Linux, and using ecpg to
> write the C program to communicate with the database.
> One of my application need to get the data from the last row in a
> table. Is there any function or command that can tract which is the
> last row of data in a tabl
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.
>
> 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?
>
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]
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 fr
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
___
Hello,
I am developing a database with PostgreSQL in Linux, and using ecpg to write the
C program to communicate with the database.
One of my application need to get the data from the last row in a table.
Is there any function or command that can tract which is the last row of data in
a table?
Tha
25 matches
Mail list logo