l) Getting the counts takes half
the time, making the flattened report takes half the time.
Oliveiros Cristina wrote:
Hello, Sandeep,
I am not sure if this is what you want.
I came up with this query
SELECT *
FROM (SELECT user_id,SUM(amount) as day1 FROM t1 WHERE create_timestamp =
'2
Hello, Sandeep,
I am not sure if this is what you want.
I came up with this query
SELECT *
FROM (SELECT user_id,SUM(amount) as day1 FROM t1 WHERE create_timestamp =
'2009-1-1' GROUP BY "user_id") a
NATURAL FULL JOIN (SELECT user_id,SUM(amount) as day2 FROM t1 WHERE
create_timestamp = '2009-1-
Howdy!
When you say that pg accepts "this" silently instead of complaining what are
you referring to exactly?
First Insert? Why wouldn't it work after all ?
What will happen is that when you try to insert a new record without
specifying the id column you'll get an error informing that
primar
al Message -
From: "Ivan Sergio Borgonovo"
To:
Sent: Monday, May 25, 2009 3:13 PM
Subject: Re: [SQL] Obtaining a limited number of records from a long query
On Mon, 25 May 2009 14:55:54 +0100
"Oliveiros Cristina" wrote:
Thanks a million, Andy.
It's precis
Thanks a million, Andy.
It's precisely what I needed, Indeed!
Best,
Oliveiros
- Original Message -
From: "Andy Shellam"
To: "Oliveiros Cristina"
Cc:
Sent: Monday, May 25, 2009 2:45 PM
Subject: Re: [SQL] Obtaining a limited number of records from a l
Dear List,
Is there any way to force a query to return just a few records?
For ex, returning just the first ten rows from a long ORDER BY query ?
And then, eventually, obtaining the remaining records at a later time, or in
background?
Thanks in advance for your help,
Best,
Oliveiros
I guess this is pretty much the same
as doing
SELECT message.id,topic.topic,message.message
FROM topics
JOIN messages
ON topics.id = message.topic
ORDER BY message.ID
Ain't I right?
Best,
Oliveiros
- Original Message -
From: James Kitambara
To: Richard Ekblom
Cc: pgsql-s
Hi, All
Suppose you have a query like this
SELECT *
FROM t_sitesresumebydate a
JOIN t_triple_association c
ON "IDSiteResume" = "IDResume"
WHERE "dtDate" BETWEEN '2009-2-1'
AND '2009-2-3'
AND "IDHitsAccount" = 378284
With this time interval it completes in less than a second.
If I add one da
Escreve a tua dúvida em inglês, por favor, isto é uma lista de mailing em
ingles.
He wants to do a report with the composition of each foreign key and primary
key, not just their names.
He wants to know where postgres keeps that in catalog.
Best,
Oliveiros
- Original Message -
From
Escribe tu duda en ingles, por favor
Saludos,
Oliveiros
- Original Message -
From: Jhonny Velasquez c.
To: pgsql-sql@postgresql.org ; pgsql-...@postgresql.org
Sent: Thursday, March 05, 2009 3:50 PM
Subject: [SQL] uso de dblink en php
hola a todos
estoy programando en
Just follow Google's motto "Don't be evil" :-)
We are all engineers from the same field,
so Let's all be friends
Best,
Oliveiros
- Original Message -
From: Boycott Tech Forums
To: pgsql-sql@postgresql.org
Sent: Sunday, February 08, 2009 6:40 AM
Subject: [SQL] Grass Root Prote
(status_id = 0)
GROUP BY name
HAVING (COUNT(*) > 1)) d
ON d.name = c.name
GROUP BY (c.name)
) b
ON a.name = b.name
AND (a.status_id <> b.estado
OR b.oldest <> a.c_date)
WHERE a.status_id = 0
)
- Original Message -
From: "Andreas"
To: "PostgresSQL list&qu
Andreas,
Does your table has any field that can be used as primary key? Any "ID"
field?
Best,
Oliveiros
- Original Message -
From: "Andreas"
To:
Sent: Thursday, January 29, 2009 11:56 AM
Subject: [SQL] I need some magical advice
Hi,
I'd like to update some records in a table.
*How can I get an AND search (people with Dark Hair AND who are President)?*
The two joins didn't work?
Or were they too slow ?
Best,
Oliveiros
2008/12/10 Bryce Nesbitt <[EMAIL PROTECTED]>
>
>
> Milan Oparnica wrote:
> > This is how I do it, and it runs fast:
> > select p.*
> > from test_people
8Dark Hair
> 8USA President
> 10Dark Hair
> \.
>
> CREATE TABLE test_people (
> people_id integer DEFAULT nextval('test_sequence'::regclass) NOT NULL,
> person_name text
> );
> COPY test_people (people_id, person_name) FROM stdin;
> 8O
Howdy, Bryce
Could you please try this out and tell me if it gave what you want.
Best,
Oliveiros
SELECT person_name
FROM test_people p
JOIN test_attributes a
ON ((a.people_id = p.people_id) AND (a."attribute" = @firstAttr))
JOIN test_attributes b
ON ((b."people_id" = p."people_id") AND (b."attri
If I understand what you need,
I guess this clause does work.
WHERE string LIKE '%substring'
Best,
Oliveiros
- Original Message -
From: Kevin Duffy
To: pgsql-sql@postgresql.org
Sent: Friday, November 21, 2008 4:30 PM
Subject: [SQL] function - string ends with
Hello All
If it is to Group the items by cat field then select the ID where the num is
the highest in group,
You could maybe try
SELECT a.ID, b.Cat,b.Num
FROM my_table a
JOIN ( SELECT cat, MAX(num) as maximo FROM my_table GROUP_BY cat) b
ON a.Cat = b.Cat
AND a.Num = b.maximo;
It 'll probably give what y
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
Pascal
Howdy, Nacef,
Try this,
SELECT a.userid
FROM orders a
JOIN orders b
USING (userid)
WHERE a.productid = 1
AND b.productid = 2
Best,
Oliveiros
- Original Message -
From: Nacef LABIDI
To: pgsql-sql@postgresql.org
Sent: Tuesday, October 28, 2008 11:14 AM
Subject: [SQL] Perfo
Your script is handy, Steve.
Spontaneously, This seems to be an array type problem, something I just have
vague notions about.
I'll take a look at this,
http://www.postgresql.org/docs/8.3/static/arrays.html to see if something
occurs...
Best,
Oliveiros
- Original Message -
From:
I guess you can change a little the query to your needs.
The problem is pretty much the same...
I've used c3 column in equality, but if this column
has repeated values, just choose any column or combination of columns which
is unique.
Best,
Oliveiros
SELECT a.c1,a.c2,b.c3,b.c4,a.c5,b.c6
FROM
(
SE
Just add two conditions on the previous query
A particularity of this approach is that the non-null record will always
appear with the first child in alphabetical order.
But, according to what you explain, I guess it is OK, and if it doesn't it
is easily changed. :-)
Also I've changed the first c
Howdy, Zied.
The query below outputs the results as you want, but
I suspect you have a more general situation you want to solve.
If you have more than one father, say "manuel", you would want something like
this ?
num father child age
1 joe bruce14
lei
Howdy, Raju.
Could you please provide a more concrete example of what you need?
What information would you like your query to return exactly?
An ordered set of records? Ordered by rank...?
Please
give an example of a search operation and intended result
Best,
Oliveiros
- Original Messag
Sorry, Lance
By mistake I posted my own things, which I was using to "adapt" to your
situation. :-)
Please kindly ignore everything below my signature :p
Best,
Oliveiros
- Original Message -
From: Oliveiros Cristina
To: Campbell, Lance ; pgsql-sql@postgresql.org
Sent
Howdy, Lance.
I had that problem about a year ago, and AFAIK there is no solution, at least
not in SQL Standard.
What I did was something like
SELECT a,b,c,count(y.a) as order
FROM t1 x , t1 y
WHERE ((x.a > y.a)
OR (x.a = y.a
AND x.ID <= y.ID)) -- Use here whatever you have as primary key
Howdy, Raju
Do you want somethin like this? Not sure if I fully understood your
requests...
SELECT "Key",MAX(Date)
FROM t_yourTable
WHERE Value LIKE 'foo'
GROUP BY Key ;
Best,
Oliveiros
- Original Message -
From: "Raj Mathur" <[EMAIL PROTECTED]>
To:
Sent: Friday, October 03, 2008 7
ver-filter-by-N
FROM (
(ownership join N on ownership.N = N.dbid)
union
(ownership join mm_N2R on ownership.R = mm_N2R.right join N on
mm_N2R.left = N.dbid )
OR
) ...
and should i bundle the filtering-by-N/Employment in every of above
union-members?
On Tuesday 30 September 2008 15:21:09 Oliveir
Hi, Svil
I 'd like to first fully understand the background of your problem before
figurin out if I can be of any help (or not).
You have a tree, of which N is the root, is this correct?
Then, what are the next sublevel?
F, P and R? If so, why is R linked to a sibling (F) ?
And the next one?
O
Howdy, Steve.
SELECT id
FROM dummy a
NATURAL JOIN (
SELECT fkey_id,name
FROM dummy
GROUP BY fkey_id,name
HAVING COUNT(*) > 1 AND SUM(id) = (MAX(id) + MIN(id)) * (MAX(id) - MIN(id) +
1) / 2
) b
ORDER BY id;
The GROUP BY clause is to associate records that have the same fkey_id and
name
The COUNT(
Can this be what you need?
Best,
Oliveiros
SELECT id
FROM dummy a
NATURAL JOIN
(
SELECT fkey_id,name
FROM dummy
GROUP BY fkey_id,name
HAVING COUNT(*) > 1
AND SUM(id) = (MAX(id) + MIN(id)) * (MAX(id) - MIN(id) + 1) / 2
) b
ORDER BY id;
- Original Message -
From: "Steve Midgley" <[E
Hi, Louis-David,
I guess you already have your problem solved, but just for the sake of
curiosity, another
way to do it might be to tweak a little your original query, I've written on
Capitals the things I've added.
Should you need to exclude more than one event you can add the conditions to
t
Hello , All.
I am not sure if this is the right mailing list to place this question.
If it doesn't, please kindly redirect me to the right list.
I have a giant table with about 10,6 million records.
Queries on it are usually slow, and if I try to do something more elaborate
like an INNER JOIN w
To: pgsql-sql@postgresql.org
Sent: Tuesday, August 19, 2008 2:36 PM
Subject: Re: [SQL] Join question
I thought of that, but it does violate table constraints.
Edward W. Rouse
From: Oliveiros Cristina [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2008 2:00 PM
To:
I don't understand your count(total) expression...
It doesnt work, because apparently you dont have any "total" column...
Apparently, you meant count(color)
The problem is that you are grouping by a.org,a.user and on table "a" u
actually dont have any "null" users...
Well, if it is to include
You can enclose the names in quotes, then the characters are allowed
Sorry to mislead you :p
Best,
Oliveiros
- Original Message -
From: Oliveiros Cristina
To: maria s ; Osvaldo Rosario Kussama ; pgsql-sql@postgresql.org ; Pavel
Stehule ; Ivan Sergio Borgonovo
Sent: Tuesday
Maria,
The minus, open bracket and close bracket are illegal as identifier names
http://www.postgresql.org/docs/8.3/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
Best,
Oliveiros
- Original Message -
From: maria s
To: Osvaldo Rosario Kussama ; pgsql-sql@postgresql.org ;
I can fetch the elements as I wish.
But I don't know is there any other way to get the data.
Thank you for your reply.
Maria
On Mon, Jul 28, 2008 at 12:56 PM, Oliveiros Cristina <[EMAIL PROTECTED]>
wrote:
Maria,
You mean your array has a variable size, which yo
Maria,
You mean your array has a variable size, which you need to know in order to
properly construct a query?
Dunno much about arrays, but here
http://www.postgresql.org/docs/8.3/static/arrays.html is said that array_upper(
your_array, 1 ) returns the upper bound of the array...
Can this be
July 16, 2008, 5:39 AM
am Tue, dem 15.07.2008, um 18:15:07 -0700 mailte Mark
Roberts folgendes:
>
> On Tue, 2008-07-15 at 14:31 +0200, A. Kretschmer
wrote:
> > am Tue, dem 15.07.2008, um 13:12:39 +0100 mailte
Oliveiros Cristina folgendes:
> > > Howdy, all,
> > >
> &
e:
am Tue, dem 15.07.2008, um 18:15:07 -0700 mailte Mark Roberts
folgendes:
>
> On Tue, 2008-07-15 at 14:31 +0200, A. Kretschmer wrote:
> > am Tue, dem 15.07.2008, um 13:12:39 +0100 mailte Oliveiros
Cristina folgendes:
> > > Howdy, all,
> > >
> > > I have a problem
Howdy, all,
I have a problem.
I have a table which one of the fields is of type date.
I need to obtain the totals of the other fields in a by-month basis
IS there any easy way to do this using the GROUP BY or any other construct?
Thanks in advance for your kind help
Best,
Oliveiros
--
Sent
Neither have I.
The LEFT JOIN I know is something like
SELECT ...
FROM table1
LEFT OUTER JOIN table2
ON
Try using this construct
Best,
Oliveiros
- Original Message -
From: "Scott Marlowe" <[EMAIL PROTECTED]>
To: "acec acec" <[EMAIL PROTECTED]>
Cc:
Sent: Friday, January 25, 2008
It worked perfectly.
Thanks a million, Scott.
Best,
Oliveiros
- Original Message -
From: "Scott Marlowe" <[EMAIL PROTECTED]>
To: "Oliveiros Cristina" <[EMAIL PROTECTED]>
Cc:
Sent: Thursday, November 08, 2007 6:03 PM
Subject: Re: [SQL] Obtaining th
Hello, All,
I have the need to know the primary key assigned to a record I've just INSERTed
.
Is there an easy way to solve this ?
Similar to SQLServer's SELECT scope_identity() ; ?
Any help deeply appreciated
Best,
Oliveiros
,date
FROM my_table
WHERE date=ANY(dates)
GROUP BY theme,receiver,date ;
But I don't know, do you need to include the column "dates" on output ?
Best,
Oliveiros
From: Loredana Curugiu
To: Oliveiros Cristina ; [EMAIL PROTECTED] ; pgsql-sql@postgresql.org
Sent: Tuesd
On 6/5/07, Oliveiros Cristina < [EMAIL PROTECTED]> wrote:
Hey, Loredana.
Hi Oliveiros! Nice to "see" you again!
Please advice me,
you need to sum for a certain pair (Theme, receiver) the number that
appears on count for every record whose date is in
bout the result
Best,
Oliveiros
2007/6/5, Loredana Curugiu <[EMAIL PROTECTED]>:
On 6/5/07, Loredana Curugiu <[EMAIL PROTECTED]> wrote:
>
>
>
> On 6/5/07, Oliveiros Cristina < [EMAIL PROTECTED]> wrote:
> >
> > Hey, Loredana.
>
>
> Hi Oliveiros!
Hey, Loredana.
Please advice me,
you need to sum for a certain pair (Theme, receiver) the number that appears
on count for every record whose date is in dates column, is this correct?
But in what record's dates column? On all of them? Or just the dates column
of the records that have that (Theme
50 matches
Mail list logo