- Original Message -
From: Oliveiros d'Azevedo Cristina
To: John Lister ; pgsql-sql@postgresql.org
Sent: Wednesday, November 17, 2010 4:09 PM
Subject: Re: [SQL] obtaining difference between minimum value and next in
size
Hi, John.
I am not familiar with the func
Salut, Louis-David,
Can you please state the columns belonging to price table
and give a concrete example?
Say, data before and data after you want to do?
Thank you
A bien-tôt,
Oliveiros
- Original Message -
From: "Louis-David Mitterrand"
To:
Sent: Tuesday, November 23,
Howdy, Michelle,
If you write something like this,
SELECT hour , COUNT(id_user) as count
FROM
(
SELECT EXTRACT(hour from my_date) as hour, id_user FROM michelle
GROUP BY EXTRACT(hour from my_date),id_user
)subquery
GROUP BY hour
for each hour it will count the number of distinct user_id's ther
Ciao
* Olá!
for each hour it will count the number of distinct user_id's there
are . If I understood correctly what you need...
Can you please test it and see if it is OK for your needs? With me,
it worked on the sample data you provided
Yes! Simply perfect!
* Great to hear it worked
Could you please
include the full insert SQL statement?
Best,
Oliveiros
- Original Message -
From: "ndias"
To:
Sent: Friday, November 26, 2010 4:22 PM
Subject: [SQL] Insert row in 1.10.1 and 1.10.3
Hello to all,
I have a question regarding the behavior of insert row
Howdy, Tarsis.
Please try this out.
SELECT a.id, id_table1,a.name
FROM "Table2" a
NATURAL JOIN
(SELECT id_table1
"Table2"
GROUP BY id_table1
HAVING COUNT(*) > 1) b
Tell me if it worked or not, and if it didn't the errors/uncorrect results.
Best,
Olive
Hi, Lu Ying.
How do you define which row is #1 ? And #2 ?
E.g. Ordered by lname? Or gname...?
Best,
Oliveiros
- Original Message -
From: "Emi Lu"
To:
Sent: Wednesday, January 26, 2011 4:11 PM
Subject: [SQL] how to get row number in select query
Good morning,
For
version 8.3 doesn't have any "non-standard SQL" way to get a row
number, but it is possible that something like that has been introduced in
later versions...
Best,
Oliveiros
- Original Message -
From: "Emi Lu"
To:
Sent: Wednesday, January 26, 2011 4:11 PM
Hi Oliveiros,
Howdy!
If it is to order in ascendent fashion by, say, lname,
one possibility would be
SELECT COUNT(b.*) as row_number, a.lname,a.gname
FROM "Table1" a, "Table2" b
WHERE a.lname >= b.lname
GROUP BY a.lname,a.gname
ORDER BY row_number
If you want
Doesn't the SELECT you indicated do what you need?
Best,
Oliveiros
- Original Message -
From: "Emi Lu"
To:
Sent: Monday, January 31, 2011 3:50 PM
Subject: [SQL] Get days between two dates?
Good morning,
Is there an existing method to get days between two date
That's precisely what I think..
:-|
- Original Message -
From: "Kenneth Marshall"
To: "Emi Lu"
Cc:
Sent: Monday, January 31, 2011 4:39 PM
Subject: Re: [SQL] Get days between two dates?
On Mon, Jan 31, 2011 at 10:50:43AM -0500, Emi Lu wrote:
Good morning,
Is there an existing me
Howdy, Tarlika.
If the data doesn't bring the AM/PM how are you supposed to distinguish
between,say, 10pm and 10am ? Does it always start at 10:30am? So 10am never
arises?
Best,
Oliveiros
- Original Message -
From: "Tarlika Elisabeth Schmitz"
To:
Sent: Tuesday, Fe
version...
Best,
Oliveiros
- Original Message -
From: "Emi Lu"
To:
Sent: Wednesday, April 20, 2011 4:45 PM
Subject: [SQL] How to realize ROW_NUMBER() in 8.3?
Hello,
ROW_NUMBER() is only ready in 8.4. For 8.3, is there a simple way to get
row_number
select row_number(),
;t be overlapping, right?
Best,
Oliveiros
- Original Message -
From: "Andreas"
To:
Sent: Thursday, June 09, 2011 2:43 PM
Subject: [SQL] need help with some aggregation magic
hi,
I have a log-table that stores events of users and projects like this
( user_id integer, project
Howdy, Marcel,
In the example output you provided the ID = 2 should have just one
record...Ain't I right?
Best,
Oliveiros
- Original Message -
From: Jira, Marcel
To: 'pgsql-sql@postgresql.org'
Sent: Wednesday, June 15, 2011 4:23 PM
Subject: [SQL] Merge o
(IMHO) as much as
1 2000-01-01 2000-03-31
1 2000-04-01 2000-05-31
are. Isn't my understanding correct?
Best,
Oliveiros
(SELECT x."ID",x."BEG",x."END"
FROM mytable x
LEFT JOIN
(
SELECT a."ID" as xid ,a."BEG" as xbeg,a."END&
- Original Message -
From: LALIT KUMAR
To: Oliveiros d'Azevedo Cristina
Hi,
I do have order of rows. The problem originally is: I need to set all flag
with value 0 to -1 whose next row has flag as 1. This is to be done for each
city separetly, i.e. flag of last r
Strange...
Tables have hidden columns but AFAIK, "name" is not one of them...
http://www.postgresql.org/docs/9.0/interactive/ddl-system-columns.html
Best,
Oliveiros
- Original Message -
From: "Nikolay"
To:
Sent: Thursday, August 04, 2011 3:50 PM
Subject: [SQ
like you need a function
something
like
CREATE FUNCTION customer_table(int) RETURNS customer_table
AS $$ SELECT COUNT(DISTINCT costumer_id),AVG(price) FROM customer_table
WHERE productid = $1 $$
LANGUAGE SQL;
HTH
Best,
Oliveiros
- Original Message -
From: "tlund79"
Something like this...?
SELECT first_name,surname, email1 || ';' || email2
FROM t_your_table;
Best,
Oliver
- Original Message -
From: "gvim"
To: "pgsql sql"
Sent: Thursday, August 25, 2011 3:21 PM
Subject: [SQL] Add one column to another
I have to deal with a table which contain
Something like
ALTER TABLE t_yourtable DROP CONSTRAINT
and then
ALTER TABLE t_yourtable ADD FOREIGN KEY
?
Best,
Oliveiros
- Original Message -
From: "Emi Lu"
To:
Sent: Friday, October 21, 2011 2:36 PM
Subject: [SQL] how to temporally disable foreign key constraint che
't scale well if you have many more items beyond
three...
Best,
Oliveiros
- Original Message -
From: Abhinandan Raghavan
To: pgsql-sql@postgresql.org
Sent: Tuesday, December 06, 2011 1:57 PM
Subject: [SQL] Self-Join
Hi,
I'm looking to frame an SQL statement
I have not.
I've already skimmed through it.
Indeed, it is very interesting
Thanx , Scott
Best,
Oliver
- Original Message -
From: "Scott Swank"
To: "Oliveiros d'Azevedo Cristina"
Cc: "Abhinandan Raghavan" ;
Sent: Tuesday, December 06, 2
UPDATE admin
SET parent = SUBSTR(id,1,4);
Doesn't it do what you want?
Best,
Oliveiros
- Original Message -
From: "ssylla"
To:
Sent: Thursday, February 09, 2012 1:58 AM
Subject: [SQL] update column
Dear list,
sorry, I already posted this, but it did not se
two cents
Best,
Oliveiros
I've googled this but can't find a suitable solution. Can anyone help
please.
--
Gary Stainburn
Group I.T. Manager
Ringways Garages
http://www.ringways.co.uk
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to you
here.
You'll have to substitute my col1, col2, etc with your actual column names.
Best,
Oliveiros
SELECT query1.t1_id, t1.col2,t1.col3,t1.col4, query1.minimum
FROM (
SELECT t3.col2 as t1_id, MIN(t2.col2) as minimum
FROM Table_3 t3
JOIN Table_2 t2
ON t3.col1 = t2.col1
GROUP BY t3.col2
) query1
JO
Great to Hear!
Best,
Oliver
- Original Message -
From: Swärd Mårten
To: Oliveiros d'Azevedo Cristina ; pgsql-sql@postgresql.org
Sent: Thursday, March 01, 2012 11:01 AM
Subject: Re: [SQL] Aggregate and join problem
It worked like a charm! Many thanks for that
I'm affraid
you can't.
AFAIK,
WHERE clause is processed before the SELECT output expressions
Best,
Oliveiros
- Original Message -
From: "Marcel Ruff"
To:
Sent: Friday, May 04, 2012 11:25 AM
Subject: [SQL] How change col name during query to use it in where
Gary,
You describe two tables vehicle stock and tax requests. The former has a
one-to-many relationship wit the second one, right?
But your query involves stock details and used_diary.
What is the relationship of these two new tables to the previous ones?
Could you please kindly supply an ex
09:15:31.569471 |
42363 | 2012-05-16
(2 rows)
On Wednesday 23 May 2012 10:37:31 Oliveiros d'Azevedo Cristina wrote:
Gary,
You describe two tables vehicle stock and tax requests. The former has a
one-to-many relationship wit the second one, right?
But your query involves stock details and used_diar
= u.ud_pex_registration
where s_stock_no = 'UL15470';
GROUP s_stock_no,s_regno,s_vin,s_created
) subq
JOIN
used_diary sec
ON subq.m = sec.ud_id
Best,
Oliver
- Original Message -
From: "Oliveiros d'Azevedo Cristina"
To: "Gary Stainburn" ;
Sent: Wednesday, May 23, 20
Hi, Gary,
Unless I'm mistaken this didn't give what you need.
Could you please tell me (if you have time) the error returned or wrong
result, just for my own understanding of where I've gone sideways on
this...?
Best,
Oliver
- Original Message -
From: "Oliveiro
Hi, Mike,
Can you tell me if this gives what you want, and if it doesn't, what is the
error reported, or wrong result ?
This is untested query, so Im not sure about it.
Best,
Oliver
SELECT make, model, color,type, subquery1.cpp, min(cost/yield) as cpp2
(
SELECT printers.make, printers.model,
2.make,subquery2. model,
subquery2.color,subquery2.type,subquery1.cpp
ORDER BY make, model;
- Original Message -
From: "Oliveiros d'Azevedo Cristina"
To: "Relyea, Mike" ;
Sent: Friday, June 01, 2012 3:56 PM
Subject: Re: [SQL] Lowest 2 items per
Hi, Mike,
Can you
Oliver,
I had to make a few grammatical corrections on your query to get it to
run, but once I did it gave me almost correct results. It leaves out
all of the printer models that only have one consumable with a cost.
Some printers might have more than two black inks and some might have
only one
I only made grammatical changes necessary for the query to function
(adding a missing FROM, fully qualifying "SELECT Make" as " SELECT
subquery2.Make", etc.)
I tried changing the join type to right and left but that did not have
the desired result.
* I see...
If we add a query with a union tha
With a CASE ... WHEN statement?
Best,
Oliver
- Original Message -
From: "Gary Stainburn"
To:
Sent: Monday, August 20, 2012 1:17 PM
Subject: [SQL] generated dates from record dates - suggestions
Hi folks.
I've got a table with three dates which are populated from an external
sour
Have you tried this
ALTER TABLE table_name DROP CONSTRAINT constraint_name;
Best,
Oliveiros
- Original Message -
From: "Salomao Domingos"
To:
Sent: Monday, September 17, 2012 7:58 PM
Subject: [SQL] Disabling constraint check
Hi,
I'm need to import data to PostgreS
Hi, Scott.
I'd like to kick in this thread to ask you some advice, as you are
experienced in optimizing queries.
I also use extensively joins and unions (less than joins though).
Anyway, my response times are somewhat behind miliseconds, they are situated
on seconds range, and sometimes they ex
101 - 139 of 139 matches
Mail list logo