Andrew Sullivan <[EMAIL PROTECTED]> writes:
> On Fri, Sep 01, 2006 at 02:26:39PM -0300, Walter Cruz wrote:
>> So I can assume that the MySQL implementation is strange? (It accepts that
>> kind of query)
> In my experience, it is almost never safe to assume that the MySQL
> approach to SQL bears an
On Fri, 2006-09-01 at 12:26, Walter Cruz wrote:
> So I can assume that the MySQL implementation is strange? (It accepts
> that kind of query)
Yes, according to the SQL spec, you should generally get an error when
you run a query like this:
select field1, field2 from table group by field1
since y
> But, when I add another column on select, like, film_description, I get
> the following error:
>
> "ERROR: column "film.description" must appear in the GROUP BY clause or
> be used in an aggregate function"
>
> If I put that column on GROUP BY everything works ok. But I want
> understant why d
On Fri, Sep 01, 2006 at 02:26:39PM -0300, Walter Cruz wrote:
> So I can assume that the MySQL implementation is strange? (It accepts that
> kind of query)
In my experience, it is almost never safe to assume that the MySQL
approach to SQL bears anything but a passing resemblance to SQL
proper. Thi
So I can assume that the MySQL implementation is strange? (It accepts that kind of query)[]'s- WalterOn 9/1/06, Andrew Sullivan <
[EMAIL PROTECTED]> wrote:On Fri, Sep 01, 2006 at 10:31:48AM -0300, Walter Cruz wrote:
> "ERROR: column "film.description" must appear in the GROUP BY clause or be> used
On Fri, Sep 01, 2006 at 10:31:48AM -0300, Walter Cruz wrote:
> "ERROR: column "film.description" must appear in the GROUP BY clause or be
> used in an aggregate function"
>
> If I put that column on GROUP BY everything works ok. But I want understant
> why do I need to do that. Can someone teach
Hi all. I'm with a little doubt.I'm testing the pagila (the postgres port of mysql sakila sample).Well, I was trying to translate the query:select film.film_id AS FID, film.title
AS title, film.description AS description, category.name AS category, film.rental_rate AS price,
This seems to be the best solution. At first I was a bit skeptical about the perfomance using execute versus using pre-planned queries. However, I found that this model actually executes faster than the paramterized queries that I was trying (even using the if-then-endif model).
Thanks for this
Rob Tester wrote:
I have the need to have optional values for a query in a stored procedure
that I am building. (using postgres 8.1.4). This particular query
executes
against a huge table (several million rows) and has six optional
parameters
that can be sent to the function. If one of the para
On Wed, Aug 16, 2006 at 08:39:49PM -0700, Rob Tester wrote:
> What is the best way to write a query and get the planner to use indexes
> when you have optional parameters and columns that can contain NULL values?
Have you considered building a query string and using EXECUTE?
That's not as "neat" a
I have the need to have optional values for a query in a stored procedure that I am building. (using postgres 8.1.4). This particular query executes against a huge table (several million rows) and has six optional parameters that can be sent to the function. If one of the parameters is null then th
7.4.1 is quite old and has a number of serious known bugs. I'd suggest
you either upgrade to 8.1.4 (current) or, if you can't do that, at
least upgrade to 7.4.13 (latest 7.4) immediately.
Hilary Forbes wrote:
> Tom
>
> Thank you - I think that the underlying problem is that I was trying out
>
>
Tom
Thank you - I think that the underlying problem is that I was trying
out
REVOKE ALL FROM TABLE suppliers FOR public;
then connect as hilary and I can still see the table rows.
I appear to have to revoke each type eg
REVOKE SELECT FROM TABLE suppliers FOR public;
etc and then the code works.
Is
Hilary Forbes <[EMAIL PROTECTED]> writes:
> I have an existing table suppliers and I have created a new user
> 'hilary'
> REVOKE ALL on TABLE suppliers FROM hilary;
> now login as hilary
> SELECT * from suppliers;
> and I get all the records!!!
Most likely there's been a grant of (at least) select
REVOKE ALL on TABLE suppliers FROM hilary;
now login as hilary
SELECT * from suppliers;
and I get all the records!!!
If I create a **new** table though and then do the above, the permissionswork I
get a polite
message telling me "no go". Thissounds to me like a problem with earlier
compatibility
On Thu, 20 Jul 2006, Hilary Forbes wrote:
> Dear All
>
> We are running pg v 7.4.1 and importantly the database has been
> converted from earlier versions of pg (6.5 I seem to recall).
>
> I have an existing table suppliers and I have created a new user 'hilary'
>
> REVOKE ALL on TABLE suppliers F
Dear All
We are running pg v 7.4.1 and importantly the database has been converted
from earlier versions of pg (6.5 I seem to recall).
I have an existing table suppliers and I have created a new user
'hilary'
REVOKE ALL on TABLE suppliers FROM hilary;
now login as hilary
SELECT * from suppliers;
a
Oisin Glynn wrote:
I have an issue with a select returning very slowly approx 198
seconds. I took a backup of this DB and restored it on another system
and it is returning in 28 seconds.
Windows 2000 PG Version 8.0.3 Data is inserted into the table row by
row.
Table has index on service
e
I have an issue with a select returning very slowly approx 198 seconds.
I took a backup of this DB and restored it on another system and it is
returning in 28 seconds.
Windows 2000 PG Version 8.0.3 Data is inserted into the table row by row.
Table has index on service
explain SELECT
callr
On 5/12/06, Michael Joseph Tan <[EMAIL PROTECTED]> wrote:
hi,
im new in postgresql, generally new in databases.
im trying to make a function using PGAdminIII which returns several types,
example, my query is:
"select count(id) as requests, organization from connection_requests group
by organiz
hi, im new in postgresql, generally new in databases. im trying to make a function using PGAdminIII which returns several types, example, my query is: "select count(id) as requests, organization from connection_requests group by organization" id is of type int8, organization is of ty
- Original Message
From: Andrew Sullivan <[EMAIL PROTECTED]>
To: pgsql-sql@postgresql.org
Sent: Thursday, May 11, 2006 1:18:08 PM
Subject: Re: [SQL] Help with a seq scan on multi-million row table
On Thu, May 11, 2006 at 10:09:44AM -0700, [EMAIL PROTECTED] wrote:
> Hi Markus & Tom,
>
On Thu, May 11, 2006 at 10:09:44AM -0700, [EMAIL PROTECTED] wrote:
> Hi Markus & Tom,
>
> Higher statistics for this column hm, I'd love to try changing
> it to see how that changes things, but I'm afraid I don't know how
> to do that. How can I change the statistics target value for this
> c
933
This number grows daily by... not sure how much, probably 5k a day currently.
Thanks,
Otis
- Original Message
From: Markus Schaber <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: pgsql-sql@postgresql.org
Sent: Thursday, May 11, 2006 6:33:55 AM
Subject: Re: [SQL] Help with a
Markus Schaber <[EMAIL PROTECTED]> writes:
> Did you try to set higher statistics targets for this columns?
Yeah, I was about to suggest the same after looking at the pg_stats
entry. It shows estimated num_distinct as 60825, ie only about 60k
distinct values in the column, which sounds kinda low
Hi, Otis,
[EMAIL PROTECTED] wrote:
> I'm not sure which numbers you are referring to when you said the estimate is
> off, but here are some numbers:
> The whole table has 6-7 M rows.
> That query matches about 2500 rows.
>
> If there are other things I can play with and help narrow this dow
s 6-7 M rows.
That query matches about 2500 rows.
If there are other things I can play with and help narrow this down, please let
me know.
Thanks,
Otis
- Original Message
From: Tom Lane <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: pgsql-sql@postgresql.org
Sent: Wednesday, May 10,
<[EMAIL PROTECTED]> writes:
> Aha! set hashjoin=off did the trick.
>-> Index Scan using ix_user_url_tag_user_url_id on
> user_url_tag userurltag0_ (cost=0.00..157.34 rows=103 width=14) (actual
> time=1.223..1.281 rows=5 loops=1666)
> Index Cond: (userurlta
d from something called Hibernate, and I'm not sure if that will let me
set enable_hashjoin=off through its API...
Thanks,
Otis
- Original Message
From: Tom Lane <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: pgsql-sql@postgresql.org
Sent: Wednesday, May 10, 2006 8:27:01 PM
Sub
<[EMAIL PROTECTED]> writes:
>-> Hash Join (cost=2797.65..140758.50 rows=3790 width=10)
> (actual time=248.530..380635.132 rows=8544 loops=1)
> Hash Cond: ("outer".user_url_id = "inner".id)
> -> Seq Scan on user_url_tag userurltag0_
OTECTED]
Cc: pgsql-sql@postgresql.org
Sent: Wednesday, May 10, 2006 3:23:29 PM
Subject: Re: [SQL] Help with a seq scan on multi-million row table
On Wed, May 10, 2006 at 13:13:59 -0500,
[EMAIL PROTECTED] wrote:
> Hello,
>
> I have a little 2-table JOIN, GROUP BY, ORDER BY query th
On Wed, May 10, 2006 at 13:13:59 -0500,
[EMAIL PROTECTED] wrote:
> Hello,
>
> I have a little 2-table JOIN, GROUP BY, ORDER BY query that does a sequential
> scan on a multi-million row table. I _thought_ I had all the appropriate
> indices, but apparently I do not. I was wondering if anyo
Hello,
I have a little 2-table JOIN, GROUP BY, ORDER BY query that does a sequential
scan on a multi-million row table. I _thought_ I had all the appropriate
indices, but apparently I do not. I was wondering if anyone can spot a way I
can speed up this query.
The query currently takes... *g
I could probably work this out for you but I have no time today. However, as a
'plan b' maybe try this...
1- create a temp table based on all tables & conditions in the query except
for the outer table (i.e. user, ascpDef, address, invention, and user)
2- do an outer join on the above temp table
Hi all,
I have been working on converting our Informix DB to PostgreSQL. There are some
differences with SQL syntax.
I have done many outer conversion so far, but all has either one outer or simple
one. But this one I do not know how to do it. I have searched but could not find
similar to what I n
On Wednesday 12 April 2006 12:49, [EMAIL PROTECTED] wrote:
> Hi all,
> I have been working on converting our Informix DB to PostgreSQL. There are
> some differences with SQL syntax.
>
> I have done many outer conversion so far, but all has either one outer or
> simple
> one. But this one I do not k
Hi all,
I have been working on converting our Informix DB to PostgreSQL. There are some
differences with SQL syntax.
I have done many outer conversion so far, but all has either one outer or
simple
one. But this one I do not know how to do it. I have searched but could not
find
similar to what I n
> Hello,
>
> I have 2 tables where each table has a column named "comments" and the
> tables are related as a one to many. I want to concatenate all the
> comments of the many side to the one side so I wrote the following
> plpgsql function to do so.
>
>
> CREATE OR REPLACE FUNCTION fixcomment
Hello
> EXECUTE 'UPDATE sale SET comments = ' ||
Use PERFORM instead
Alexey
---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
Hello,
I have 2 tables where each table has a column named "comments" and the
tables are related as a one to many. I want to concatenate all the
comments of the many side to the one side so I wrote the following
plpgsql function to do so.
CREATE OR REPLACE FUNCTION fixcomments()
RETURNS
"A. Kretschmer" <[EMAIL PROTECTED]> writes:
> *untested*
> DELETE FROM partner_zu using partner
> WHERE partner_zu.pa_id = partner.id
> ...
> The point is the 'using ...'
You can also just set the add_missing_from to true for that one session if you
prefer. I don't think there's any plans to remo
am 06.03.2006, um 15:27:54 +0100 mailte Thomas Beutin folgendes:
> >>DELETE FROM partner_zu
> >>WHERE partner_zu.pa_id = partner.id
> >>AND partner_zu.m_id = '25'
> >>AND partner.open = 'm'
> >>AND partner.a_id = partner_zu.a_id
> >>AND partner_zu.a_id = '104335887112347';
> >DELETE FROM partner_z
Richard Huxton wrote:
Thomas Beutin wrote:
Hi,
to be compatible with the postgres standard syntax in 8.1.x i need
some help for rewriting my "delete" statements ("select" is not a
problem). I use the following statement:
DELETE FROM partner_zu
WHERE partner_zu.pa_id = partner.id
AND partne
Thomas Beutin wrote:
Hi,
to be compatible with the postgres standard syntax in 8.1.x i need some
help for rewriting my "delete" statements ("select" is not a problem). I
use the following statement:
DELETE FROM partner_zu
WHERE partner_zu.pa_id = partner.id
AND partner_zu.m_id = '25'
AND par
am 06.03.2006, um 14:25:52 +0100 mailte Thomas Beutin folgendes:
> Hi,
>
> to be compatible with the postgres standard syntax in 8.1.x i need some
> help for rewriting my "delete" statements ("select" is not a problem). I
> use the following statement:
>
> DELETE FROM partner_zu
> WHERE partne
Hi,
to be compatible with the postgres standard syntax in 8.1.x i need some
help for rewriting my "delete" statements ("select" is not a problem). I
use the following statement:
DELETE FROM partner_zu
WHERE partner_zu.pa_id = partner.id
AND partner_zu.m_id = '25'
AND partner.open = 'm'
AND pa
"Simon Kinsella" <[EMAIL PROTECTED]> writes:
> CREATE RULE rule_soft_delete_user AS ON DELETE TO users
> WHERE user_departed > now()
> DO INSTEAD
> UPDATE users SET user_departed = now()
> WHERE user_id = OLD.user_id;
This is run before the delete. However, since it's a conditional
Hello,
Can this possibly be right?
>From my troubleshooting of a DELETE rule it appears that the rule's WHERE
condition sees the *results* of the rule-actions. Apart from being pretty
odd, this is a proving to be a big problem in my situation.
Here is a cut-down example:
Given a table 'users',
On Fri, Mar 03, 2006 at 12:19:22AM -, Simon Kinsella wrote:
> Hi Andrew,
>
> I think I may have cracked this problem by combining a RULE ON DELETE which
> calls a function instead of the standard DELETE op. No triggers. It was a
Ah. Yes, likely. Yeah, you can't do that.
A
--
Andrew Sull
Sent: Thursday, March 02, 2006 12:20 PM
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] Help with trigger that updates a row prior to a
potentially aborted deletion?
On Wed, Mar 01, 2006 at 08:41:20PM -, Simon Kinsella wrote:
> Ok thanks, will check this out. Is that the same as savepoint
On Wed, Mar 01, 2006 at 08:41:20PM -, Simon Kinsella wrote:
> Ok thanks, will check this out. Is that the same as savepoints, or something
> different? (am using 8.1.2)
Yes, same thing.
> At the moment I'm investigating using a rule (rewrite the DELETE as an
> UPDATE to set the flag, then use
re if it's going to work but if
so I'll post back.
Thanks!
Simon
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Andrew Sullivan
Sent: Wednesday, March 01, 2006 6:24 PM
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] Help with trigger that updates
On Wed, Mar 01, 2006 at 01:30:23PM -, Simon Kinsella wrote:
> I'm trying to achieve this with a BEFORE DELETE trigger, which would set the
> 'marked_for_deletion' field to TRUE before attempting the delete proper.
> Then if the DELETE fails the row would still be tagged and I'd be happy.
> Prob
Simon Kinsella
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Help with trigger that updates a row prior to a
potentially aborted deletion?
On Wed, 1 Mar 2006, Simon Kinsella wrote:
> Hi all,
>
> I have a situation where a DELETE operation may (correctly) fail due
> to a RESTRICT FK
On Wed, 1 Mar 2006, Simon Kinsella wrote:
> Hi all,
>
> I have a situation where a DELETE operation may (correctly) fail due to a
> RESTRICT FK constraint. If so, I need to set a flag in the row indicating
> that it has been marked for deletion so that I can disregarded in subsequent
> queries.
>
Hello Achilleus
Thanks for your feedback. On changing the return to NULL:
According to the docs, if I return NULL in the BEFORE trigger itself, all
subsequent triggers and the row-level op itself (the actual delete) will be
skipped completely, which is no good. I will confirm this to make sure
tho
Hi all,
I have a situation where a DELETE operation may (correctly) fail due to a
RESTRICT FK constraint. If so, I need to set a flag in the row indicating
that it has been marked for deletion so that I can disregarded in subsequent
queries.
I'm trying to achieve this with a BEFORE DELETE trigger
On 3 feb 2006, at 14.06, Nigel Bishop wrote:
Thank you very much, that did the business
This should generate the same plan as the previous query, but be a
little bit more clean and easy to read:
SELECT sendto FROM users t1
WHERE domain='rusty.com' AND
username = COALESCE((SELECT username
Niklas,
Thank you very much, that did the business
Cheers
Nigel Bishop
-Original Message-
From: Niklas Johansson [mailto:[EMAIL PROTECTED]
Sent: 03 February 2006 13:00
To: Nigel Bishop
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Help writing a piece of SQL
On 3 feb 2006, at
On 3 feb 2006, at 11.43, Nigel Bishop wrote:
The query will have the username and domain passed in as variables.
If the username and domain exist then return the sendto
The bit I’m struggling with is if the username doesn’t exist then
return the sendto where the domain exists
e.g. username=
Bishop
ioko
T: +44 (0)1904 435 458
M: +44 (0)7881 624 386
F: +44 (0)1904 435 450
E: [EMAIL PROTECTED]
W: www.ioko.com
-Original Message-
From: Richard Huxton [mailto:[EMAIL PROTECTED]
Sent: 03 February 2006 11:02
To: Nigel Bishop
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Help
Nigel Bishop wrote:
username |domain |sendto
+-+---+-
-
Postmaster | intthit08.uk.rabbit.com | root
root | intthit08.uk.rabbit.com | [EMAIL PROTECTED]
stoat.grif
Hi, I would appreciate some help
writing a piece of SQL
PG803
My table/data looks like
this:
username
|
domain |
sendto
+-+---+--
Postmaster
| intthit0
"Daniel Caune" <[EMAIL PROTECTED]> writes:
> Is there a way to define a function as a procedure, I mean a function
> that returns nothing.
In recent versions you can say RETURNS VOID, which is a bit of a hack
but it gets the point across...
regards, tom lane
-
Hi,
Is there a way to define a function as a procedure, I
mean a function that returns nothing.
CREATE OR REPLACE FUNCTION foo()
AS $$
BEGIN
END;
$$ LANGUAGE 'plpgsql';
Actually, PostgreSQL complains as a “function
result type must be specified”. I can patch my function
or, from the "stupid tricks" category:
SELECT
n.user_id,
max(lpad(extract(epoch from n.modified_date),12,'0') || ' ' || note)
FROM notes n
GROUP by n.user_id
i am not *really* suggesting this!
---(end of broadcast)---
TIP 5: don't forget
If you want the latest by user, you can cheat a bit and use the fact that
the id's are incrementing, thus ordering by the id
is about the same as ordering by the date field. I know it can be inexact
in some corner cases, but it's a good approximation, and
very useful in practice :
SELECT user
At 06:58 PM 12/28/05, Collin Peters wrote:
The following query will return me all the latest dates, but I can't
return the note_id or subject with it.
SELECT n.user_id, max(n.modified_date)
FROM notes n
GROUP by n.user_id
ORDER BY n.user_id
Is this simpler than I am making it?
No, it's not "s
Collin Peters <[EMAIL PROTECTED]> writes:
> Is there a nice simple query I can run that will return me a list of
> all the *latest* notes for all users (users can have many notes in the
> table)?
You can use SELECT DISTINCT ON for that, if you don't mind using a
Postgres-only feature. See the "we
I have a simple table called notes which contains notes for users.
The table has 4 columns: note_id (auto-incrementing primary key),
user_id (foreign key to a users table), note (varchar), and
modified_date (timestamp).
Is there a nice simple query I can run that will return me a list of
all the
Michael,
Thanks heaps for that!
Cheers,
Matt Smith
On Thu, 22 Dec 2005 01:37 pm, Michael Fuhr wrote:
> On Thu, Dec 22, 2005 at 11:59:24AM +1100, Matthew Smith wrote:
> > Sadly I am using 7.3, it seems that generate_series() is 8.0 and later.
>
> Yes, but it's easily written in PL/pgSQL for earl
On Thu, Dec 22, 2005 at 11:59:24AM +1100, Matthew Smith wrote:
> Sadly I am using 7.3, it seems that generate_series() is 8.0 and later.
Yes, but it's easily written in PL/pgSQL for earlier versions.
Example:
CREATE FUNCTION generate_series(integer, integer)
RETURNS SETOF integer AS '
DECLARE
Richard (and list),
Thanks for the help! More below:
On Wed, 21 Dec 2005 09:04 pm, Richard Huxton wrote:
> Matthew Smith wrote:
> > I want to form a query that returns the average total usage for each day
> > of the week, eg:
>
> [snip]
>
> > To get this info, I am using the following query:
> >
Matthew Smith wrote:
I want to form a query that returns the average total usage for each day of
the week, eg:
[snip]
To get this info, I am using the following query:
select dow as day, sum(sum_data)/count(dow) as avg_usage from
(select extract('dow' from date_trunc('day', time)) as dow, sum
Calin Meze wrote:
I need to test each record of a cursor for some requirements,
something like this
[snip]
-- the problem is that I do not know how to make the while loop
execute until the last record "WHILE (still in the cursor)"... So I
need something like
Can anyone help me with this? It
Hello,
I have a table containing a timestamp and data usage fields (among others).
This table stores amounts of data usage and the times then the data was used,
eg:
time | data
+--
2005-03-26 09:32:43+11 | 162
I want to form a query that retu
I need to test each record of a cursor for some requirements, something like thisDECLARE xpvnr varchar(50); xdata date; xcod int; xagentd varchar(3); xid bigint; xserie varchar(4); xnr varchar(7); xsocasig varchar(3); DECLARE myCursor CURSOR FOR
On Sat, Dec 17, 2005 at 07:34:22PM -0500, Michael Avila wrote:
> The table is not empty. I did some playing around with the SQL Statement but
> got no where. So I added a record status column that will be non-NULL when
> the status becomes history because a new status is added. Yeah, I cheated to
>
for the help.
Mike
> -Original Message-
> From: Michael Fuhr [mailto:[EMAIL PROTECTED]
> Sent: Saturday, December 17, 2005 7:26 PM
> To: Michael Avila
> Cc: SQL PostgreSQL MailList
> Subject: Re: [SQL] Need SQL Help Finding Current Status of members
>
>
> On
On Fri, Dec 16, 2005 at 07:44:46PM -0500, Michael Avila wrote:
> Just tried it and it returned nothing.
>
> > > Select * from memberstatus A where not exists
> > >(select * from emberstatus B where B.member_id=A.member_id and
> > > B.status_date >A.status_date)
>
> Why the WHERE NOT EXISTS?
On Fri, Dec 16, 2005 at 14:03:14 -0200,
Alexandre Gonçalves Jacarandá <[EMAIL PROTECTED]> wrote:
> Guys, I can do what I need but I have other problem: How can I named
> columns with another data ? For example:
You might be better off doing this in your application rather than entirely
with sql.
ROTECTED]
> > [mailto:[EMAIL PROTECTED] Behalf Of Patrick JACQUOT
> > Sent: Friday, December 16, 2005 5:12 AM
> > Cc: SQL PostgreSQL MailList
> > Subject: Re: [SQL] Need SQL Help Finding Current Status of members
> >
> >
> > Richard Huxton wrot
Guys, I can do what I need but I have other problem: How can I named
columns with another data ? For example:
select * from crosstab('select pessoa_nome(ref_pessoa), ref_disciplina,
nota_final from matricula where ref_periodo = ''25CASI'' order by 1,2',
'select ref_disciplina from disciplinas_ofer
Michael Avila wrote:
> Interesting. I think I understand that. I have never worked with a SELECT
> within a SELECT (I think that is called a subquery). I am guessing that it
> works its way through the member status records until the latest date
> "floats" to the top (nothing is > than it).
>
> Wil
m performance-wise if there are thousands of records?
Thanks for the help.
Mike
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Patrick JACQUOT
> Sent: Friday, December 16, 2005 5:12 AM
> Cc: SQL PostgreSQL MailList
> Subject:
Richard Huxton wrote:
Michael Avila wrote:
I have a table which keeps track of the status of members. In the
table is
member_id int(8)
status_code char(1)
status_date date
KEY member_id (member_id,status_code,status_date)
Each member can have multiple records because a record is added each
Michael Avila wrote:
I have a table which keeps track of the status of members. In the table is
member_id int(8)
status_code char(1)
status_date date
KEY member_id (member_id,status_code,status_date)
Each member can have multiple records because a record is added each time
the status chan
On Thu, Dec 15, 2005 at 08:31:09PM -0500, Michael Avila wrote:
> What I want to do is find the latest status for each member. Actually I want
> to find all those with an status of "A". But it must be the current (latest)
> status. How do I find the most current date for each member in a pile of
> m
I have a table which keeps track of the status of members. In the table is
member_id int(8)
status_code char(1)
status_date date
KEY member_id (member_id,status_code,status_date)
Each member can have multiple records because a record is added each time
the status changes but the old record i
Thanks Andrew, Osvaldo ( Obrigado) and Aaron !! Sory Andrew the right
version number is 7.4.3 and I'll study the crosstab because it's seems
to fit for sutuation.
See you...
Andrew Sullivan escreveu:
> I think you can do this with the contrib/crosstab stuff. But AFAIK,
> there's no such thing as
Have you considered using a view to create the report?
AaronOn 12/7/05, Alexandre Gonçalves Jacarandá <[EMAIL PROTECTED]> wrote:
Hello everyone, I'm using postgresql form an year and I have somedifficult to write a function to make an report. I'm running PostgreSQL7.5.3 on i686-pc-linux-gnu (Mandr
Hello everyone, I'm using postgresql form an year and I have some
difficult to write a function to make an report. I'm running PostgreSQL
7.5.3 on i686-pc-linux-gnu (Mandriva 10.1). My table structure is:
Tabela "public.matricula"
Column | Type |Modifiers
NosyMan wrote:
Hi everyone,
I have some kind of strange problem. I want to build general parametrized
trigger for my database. The parameter sent to the trigger contains a column
name that trigger should be check.
The 'vt' variable contains the column name. In the above statement I want th
Hi everyone,
I have some kind of strange problem. I want to build general parametrized
trigger for my database. The parameter sent to the trigger contains a column
name that trigger should be check.
CREATE OR REPLACE FUNCTION F_T_IU__check() RETURNS trigger AS $$
DECLARE
On Wed, 2005-10-05 at 14:21 +0200, Frank van Vugt wrote:
> Hi Joost,
>
> Try joining and comparing the order table with/to an aggregated orderline
> table, something like this:
>
> select order_id, order_price, sum_price, order_price - sum_price as diff
> from order, (select parent_order_id, su
Hi Joost,
Try joining and comparing the order table with/to an aggregated orderline
table, something like this:
select order_id, order_price, sum_price, order_price - sum_price as diff
from order, (select parent_order_id, sum(orderline_price) as sum_price
from orderline group by parent_
order_price NOT IN (select sum(orderline_price) from orderline group by
parent_order_id)
HTH,
Greg Williamson
DBA
GlobeXplorer LLC
-Original Message-
From: [EMAIL PROTECTED] on behalf of Joost Kraaijeveld
Sent: Wed 10/5/2005 4:35 AM
To: Pgsql-sql@postgresql.org
Cc:
Subject:[SQL
Hi,
I have 2 tables with the following columns:
order: order_id, order_price
orderline: parent_order_id, orderline_price
I want all orders order where _price <> sum(orderline_price).
What is wrong with the following query:
select order_id from order, orderline
where order_id = parent_order_id
On Wed, Sep 07, 2005 at 05:37:47PM -0400, Matt Emmerton wrote:
>
> - Original Message -
> From: Russell Simpkins
> To: pgsql-sql@postgresql.org
> Sent: Wednesday, September 07, 2005 4:05 PM
> Subject: Re: [SQL] Help with multistage query
>
> I
hursday, September 22, 2005 2:12 PM
> To: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Help with a view
>
>
> On Thursday 22 September 2005 20:03, Dmitri Bichko wrote:
>
> > SELECT * FROM principals WHERE event = 15821 AND person != 2?
>
> Sure, that's a concis
101 - 200 of 470 matches
Mail list logo