On Wed, Sep 23, 2009 at 6:33 PM, Jim wrote:
> On Sep 23, 5:43 am, AnthonyV wrote:
> > Hello,
> >
> > I have a table like :
> >
> >date|value
> > ---
> > 2009-09-19 | 1
> > 2009-09-20 | 2
> > 2009-09-21 | 6
> > 2009-09-22 | 9
> > 200
On Sep 23, 5:43 am, AnthonyV wrote:
> Hello,
>
> I have a table like :
>
> date | value
> ---
> 2009-09-19 | 1
> 2009-09-20 | 2
> 2009-09-21 | 6
> 2009-09-22 | 9
> 2009-09-23 | 1
>
> I'd like a request which gives me the sum of each
Hello,
I have a table like :
date|value
---
2009-09-19 | 1
2009-09-20 | 2
2009-09-21 | 6
2009-09-22 | 9
2009-09-23 | 1
I'd like a request which gives me the sum of each last n days.
For example, if I want the sum of each 3 days,
"Pascal Tufenkji" <[EMAIL PROTECTED]> writes:
> I understand the fact that "the inner query is executed before the outer
> query and the inner query doesn't even know about the outer query."
>
> But why the following query can be executed, although the inner query is
> using the outer query.
>
>
53 PM
To: [EMAIL PROTECTED]
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Subqueries
The "v" reference need to exist in the inner query. You can't use an "outer
query reference" in the inner query.
This happens because the inner query is executed before the outer query and
The "v" reference need to exist in the inner query. You can't use an "outer
query reference" in the inner query.
This happens because the inner query is executed before the outer query and
the inner query doesn't even know about the outer query.
May be this helps you get what you want.
SELECT *,
alias v not visible in sub-query?
- Original Message -
From: Pascal Tufenkji
To: pgsql-sql@postgresql.org
Sent: Thursday, October 30, 2008 12:17 PM
Subject: [SQL] Subqueries
Hello,
I don't understand the following error.
Can anyone help me plz
Thx
P
Hello,
I don't understand the following error.
Can anyone help me plz
Thx
Pascal
select *
from sip_vacations_v v
left join
(
select pe.emp_id,mg.mat_id,mg.groupe,count(p.id) * 1.5 as nb_heures
from mat_grp_v mg
inner join planification_v p on p.mat_grp_id = mg.id
hi,
Adam Witney wrote, On 5/11/2004 02:09:
Hi,
I am using a function in a subquery, this works ok:
SELECT name, (SELECT p_my_func(1)) AS id
FROM test;
However I would like to have the function return 2 values into the main
query... Something like this:
SELECT name, (SELECT p_my_func(1)) AS (id
Hi,
I am using a function in a subquery, this works ok:
SELECT name, (SELECT p_my_func(1)) AS id
FROM test;
However I would like to have the function return 2 values into the main
query... Something like this:
SELECT name, (SELECT p_my_func(1)) AS (id, type)
FROM test;
Of course this give
Rod Taylor <[EMAIL PROTECTED]> writes:
> Oh yeah, sorry. It needs to be like that because otherwise it is unsure
> what value to use for event. What you really want is a min function
> that runs a min on date, and returns the appropriate event -- which
> doesn't exist, but I believe could be crea
On Sun, Sep 07, 2003 at 09:09:35AM -0400, Rod Taylor wrote:
> [skip]
> >
> > Thanks everybody for responses. I'm trying this one, but psql complains
> > on queries like "SELECT min(date), event FROM events GROUP BY item" that
> > events must be GROUPed or used in an aggregate function. Why thi
On Sun, 2003-09-07 at 07:42, Alexei Chetroi wrote:
> On Sat, Sep 06, 2003 at 01:21:36PM -0400, Rod Taylor wrote:
> > > I'd like to write a query which returns following information regarding
> > > each item: item, date of very first event, very last event.
> > > Is this possible? I think I can wr
On Sat, Sep 06, 2003 at 01:21:36PM -0400, Rod Taylor wrote:
> > I'd like to write a query which returns following information regarding
> > each item: item, date of very first event, very last event.
> > Is this possible? I think I can write several SELECT queries and
> > procces them by an appli
> I'd like to write a query which returns following information regarding
> each item: item, date of very first event, very last event.
> Is this possible? I think I can write several SELECT queries and
> procces them by an application or possibly write some procedure, but
> what is better soluti
On Sat, Sep 06, 2003 at 14:07:09 +0300,
Alexei Chetroi <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I need a little help regarding writing some subqueries. For example I
> have a table "items" which contains columns: itemid, description; and
> another table "events" with columns: itemid, date, eve
Hi All,
I need a little help regarding writing some subqueries. For example I
have a table "items" which contains columns: itemid, description; and
another table "events" with columns: itemid, date, event. events.itemid
references items.itemid. Table events contains events regarding some
itemid'
>> I've tried, but, as the subselect is an aggregate, I can't get it (maybe
>> I don't know enough about it to do it :)
>
> Right, that'd make it harder. :)
>
> Hmm, would something like:
>
> FROM
> (select *,
> (select sum(ff.montant_ttc/df.taux) from facture ff join
> devise as df using
On Tue, 20 Aug 2002, Mathieu Arnold wrote:
> --On lundi 19 août 2002 09:45 -0700 Stephan Szabo
> <[EMAIL PROTECTED]> wrote:
>
> >
> > On Mon, 19 Aug 2002, Mathieu Arnold wrote:
> >
> >> Hi
> >>
> >> I have my accounting in a database, and I have a problem with subqueries,
> >> here is what I have
--On lundi 19 août 2002 09:45 -0700 Stephan Szabo
<[EMAIL PROTECTED]> wrote:
>
> On Mon, 19 Aug 2002, Mathieu Arnold wrote:
>
>> Hi
>>
>> I have my accounting in a database, and I have a problem with subqueries,
>> here is what I have :
>>
>>
>>
>> SELECT f.numero,
>> f.id_clie
On Mon, 19 Aug 2002, Mathieu Arnold wrote:
> Hi
>
> I have my accounting in a database, and I have a problem with subqueries,
> here is what I have :
>
>
>
> SELECT f.numero,
> f.id_client,
> f.date_creation,
> (f.date_creation + (f.echeance_paiement||' days')::inter
Hi
I have my accounting in a database, and I have a problem with subqueries,
here is what I have :
SELECT f.numero,
f.id_client,
f.date_creation,
(f.date_creation + (f.echeance_paiement||' days')::interval)::date
AS echeance,
f.montant_ttc,
ROUND(
"Josh Berkus" <[EMAIL PROTECTED]> writes:
> Until you can upgrade, though, try this approach:
> CREATE VIEW c_aggregate AS
> SELECT sum(a) as sum_a, b FROM c GROUP BY b;
> SELECT max(sum_a) FROM c_aggregate;
Unfortunately that won't work in 7.0 --- grouped views have a lot of
problems in that v
Sara,
Hey! Great to see that Postgres has made it to Israel. What's the
most popular Linux distribution there?
I think you have your answer ... an upgrade. RPMs for most major
distributions of Linux should be available within the week.
Until you can upgrade, though, try this approach:
CREA
Sara Cohen <[EMAIL PROTECTED]> said:
> Hi,
>
> I am attempting to use subqueries in the select clause of a query
> and am encountering difficulties.
>
> The Problem:
>
>
> I would like to use a subquery that returns one column, but more than one
> tuple. The result of this subquer
On Wed, 18 Apr 2001, Sara Cohen wrote:
> The Problem:
>
>
> I would like to use a subquery that returns one column, but more than one
> tuple. The result of this subquery is then used in an aggregate function.
>
> For example, suppose I have a table c, with columns a and b of
> num
Sara Cohen <[EMAIL PROTECTED]> writes:
> Using Oracle, I could get by this problem with:
> select max(d) from ((select count(b) as d from c group by a));
> However, my version of postgres doesn't support subqueries in the from
> clause.
Time to update to 7.1...
rega
Hi,
I am attempting to use subqueries in the select clause of a query
and am encountering difficulties.
The Problem:
I would like to use a subquery that returns one column, but more than one
tuple. The result of this subquery is then used in an aggregate function.
For example, sup
Christof Glaser wrote:
[ . . . ]
> since the where clause compares just one field for equality. You might
> try IN instead of =, ie
>
> update index set level = 2 where parentid in ( select id from
> index where level = 1 );
That was it! Thanks, Frank
Frank Joerdens <[EMAIL PROTECTED]> writes:
> mpi=# update index set level = 2 where parentid = ( select id from
> index where level = 1 );
> ERROR: More than one tuple returned by a subselect used as an expression.
Apparently the subquery "select id from index where level = 1" is
returning more
Frank Joerdens wrote:
> mpi=# update index set level = 2 where parentid = ( select id from
> index where level = 1 );
> ERROR: More than one tuple returned by a subselect used as an
> expression. mpi=#
>
> This is a recursive query, on a single table. Is that not possible?
Hi Frank,
as the err
I am trying to do something that looks to me exactly like what's described in chapter
8.4
in the Postgresql book:
test=> UPDATE salesorder
test-> SET ship_date = '11/16/96'
test-> WHERE customer_id = (
test(> SELECT customer_id
test(> FROM customer
test(> WHERE name = 'Fleer Gearworks, Inc.'
tes
nal Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> [EMAIL PROTECTED]
> Sent: 08 December 2000 13:00
> To: liste SQL
> Subject: [SQL] subqueries as values in updates
>
>
> hello, list.
> are subqueries alloved as values in an update
hello, list.
are subqueries alloved as values in an update command ?
e.g.
update a set a.attribute1 = a.attribute1 +
(select sum(b.attribute1) from b where b.attribute2=a.attribute2);
If yes, how is the correct syntax ?
If not, is there a hope for it in a future version ?
Pierre Habraken <[EMAIL PROTECTED]> writes:
> It looks like if subqueries in from clause are not supported by
> PostgreSQL. Am I right ? If yes, are there any plans to provide this
> feature soon ?
Already there in current sources for 7.1 ...
regards, tom lane
It looks like if subqueries in from clause are not supported by
PostgreSQL. Am I right ? If yes, are there any plans to provide this
feature soon ?
I would like to use Postgres for teaching SQL as a replacement for a
well known commercial product which I find too heavy, too not open
source, too e
Meszaros Attila <[EMAIL PROTECTED]> writes:
> How far is the above subject from beeing implemented?
I'm looking at it right now ... no promises yet, though.
regards, tom lane
Hi All,
My question for this week:
How far is the above subject from beeing implemented?
(I've run through the archives, and found some quite old mails in
this topic. They mentioned automatically generated temp tables as possibe
solutions... Is this the plan even today?)
Attila
Ps.:
Two weeks
38 matches
Mail list logo