v42013-04-10 16:25:27+08 2013-04-10 16:24:07+08Zone1 13
Srv4
2013-04-10 17:17:39+08 2013-04-10 17:14:40+08Zone1 13 Srv4
2013-04-11
21:39:05+08 2013-04-11 21:28:22+08
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/SQL-query-with-Overlapp
Hello,
there were 3 hours in between the 2 queries. so I guess new data was loaded
already. new data is being loaded with that etl_run_id.
wkr,
Bert
On Mon, Feb 18, 2013 at 4:20 PM, Виктор Егоров wrote:
> 2013/2/18 Bert
>
>> When I don't touch the indexscan setting I get the following output
On 02/18/2013 16:20, Julien Cigar wrote:
On 02/18/2013 15:39, Bert wrote:
Hello,
Thanks the nice people on irc my problem is fixed.
I changed the following settings in the postgres.conf file:
default_statistics_target = 5000 -> and I analyzed the tables after
the change of course -> now I only
On 02/18/2013 15:39, Bert wrote:
Hello,
Thanks the nice people on irc my problem is fixed.
I changed the following settings in the postgres.conf file:
default_statistics_target = 5000 -> and I analyzed the tables after
the change of course -> now I only got 2 plans anymore, in stead of 3
defa
2013/2/18 Bert
> When I don't touch the indexscan setting I get the following output:
> Total query runtime: 611484 ms.
> 20359 rows retrieved.
> and the following plan: http://explain.depesz.com/s/sDy
>
> However, when I put set enable_indexscan=off; in fron of the same query I
> get the followi
Hello,
Thanks the nice people on irc my problem is fixed.
I changed the following settings in the postgres.conf file:
default_statistics_target = 5000 -> and I analyzed the tables after the
change of course -> now I only got 2 plans anymore, in stead of 3
cpu_tuple_cost = 0.1 -> by setting this va
Hello,
yes, the tables are vacuumed every day with the following command: vacuum
analyze schema.table.
The last statistics were collected yesterday evening. I collected
statistics about the statistics, and I found the following:
table_name; starttime; runtime
"st_itemseat";"2013-02-17 23:48:42";"0
Am 18.02.2013 10:43, schrieb Bert:
> Does anyone has an idea what triggers this bad plan, and how I can fix it?
Looks a bit like wrong statistics. Are the statistiks for your tables
correct?
Cheers,
Frank
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your sub
On 12/29/2012 11:05 AM, JORGE MALDONADO wrote:
I have a query similar to the one shown below but, depending on the
value of a field, only the first SELECT statement shoud execute and the
other 3 should be ignored. Is there a way to achieve this situation?
Probably so, but is hard to be specific
Change the conditions of other 3 queries, so those shall give empty row sets
depending on your value.
29.12.2012, 23:06, "JORGE MALDONADO" :
> I have a query similar to the one shown below but, depending on the value of
> a field, only the first SELECT statement shoud execute and the other 3 sho
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of JORGE MALDONADO
Sent: Saturday, December 29, 2012 2:06 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Query execution based on a condition
I have a query similar to the one shown below but, depending on
I have a query similar to the one shown below but, depending on the value
of a field, only the first SELECT statement shoud execute and the other 3
should be ignored. Is there a way to achieve this situation?
SELECT fields FROM tblTable WHERE condition
UNION
SELECT fields FROM tblTable WHERE condi
09, 2012 1:26 PM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Query with LIMIT clause
>
> I have the following records that I get from a query, the fields are date
> type in day/month/year format:
>
> -
> Initial Final
> Date
ber 09, 2012 1:26 PM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Query with LIMIT clause
>
> I have the following records that I get from a query, the fields are date
> type in day/month/year format:
>
> -
> Initial
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org]
On Behalf Of JORGE MALDONADO
Sent: Sunday, September 09, 2012 1:26 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] Query with LIMIT clause
I have the following records that I get from a query, the fields are date
type in
I have the following records that I get from a query, the fields are date
type in day/month/year format:
-
Initial Final
DateDate
-
27/08/2012 04/09/2012
29/08/2012 09/09/2012
28/08/2012 09/09/2012
I need to tag entities in my db with arbitrary strings. That part is
simple enough. The difficulty is that I need to select entities based on
whether they match an expression built via boolean combinations of tags:
(tag1 || tag2 || tag3) && tag4
I can roll my own tagging mechanism, in which case
On Jul 22, 2012, at 23:04, ssylla wrote:
> Dear list,
>
> assuming I have two tables as follows
>
> t1:
> id_project|id_auth
> 1|1
> 2|2
>
> t2:
> id_project|id_auth
> 1|2
> 2|1
>
>
> and a lookup-table:
>
> t3
> id_auth|name_auth
> 1|name1
> 2|name2
>
> Now I want to query
Dear list,
assuming I have two tables as follows
t1:
id_project|id_auth
1|1
2|2
t2:
id_project|id_auth
1|2
2|1
and a lookup-table:
t3
id_auth|name_auth
1|name1
2|name2
Now I want to query t1 an t2 using the 'name_auth' column of lookup-table
t3, so that I get the following out
On 01/26/2012 04:00 AM, John Tuliao wrote:
I seem to have a problem with a specific query:
The inside query seems to work on it's own:
select prefix
from john_prefix
where strpos(jpt_test.number,john_prefix.prefix) = '1'
order by char_length(john_prefix.prefix) desc limit 1
but when I execute
I seem to have a problem with a specific query:
The inside query seems to work on it's own:
select prefix
from john_prefix
where strpos(jpt_test.number,john_prefix.prefix) = '1'
order by char_length(john_prefix.prefix) desc limit 1
but when I exec
On Jan 17, 2012, at 8:35, Andreas Kretschmer wrote:
> Alok Thakur wrote:
>
>> Dear,
>>
>> I am trying to provide you as much details as possible.
>>
>> answer` (
>> `id` int(10) NOT NULL AUTO_INCREMENT,
>> `question_id` int(10) NOT NULL,
>> `user_id` int(10) NOT NULL,
>> `answer` int(10)
Alok Thakur wrote:
> Dear,
>
> I am trying to provide you as much details as possible.
>
> answer` (
> `id` int(10) NOT NULL AUTO_INCREMENT,
> `question_id` int(10) NOT NULL,
> `user_id` int(10) NOT NULL,
> `answer` int(10) NOT NULL, ->
> `status` tinyint(1) NOT NULL, --> Status wil
FROM
> UserTable INNER JOIN result ON UserTable.id = result.user_id
>
> Sent from my Windows Phone
> From: Alok Thakur
> Sent: 15/01/2012 22:08
> To: pgsql-...@postgresql.org
> Subject: [SQL] sql query problem
> Dear All,
>
> I have two tables one contains details of user an
Thank you so much for your prompt reply David. I will consider your
advice and put it to mind and action. I hope you all don't get tired of
helping!
For now, I will note down what I need to and do the necessary
adjustments. Thank you for your time!
On Friday, 13 January, 2012 10:26 PM, David
result.user_id
Sent from my Windows Phone
From: Alok Thakur
Sent: 15/01/2012 22:08
To: pgsql-sql@postgresql.org
Subject: [SQL] sql query problem
Dear All,
I have two tables one contains details of user and other contains
result. The details are:
1. UserTable - id, name, phone
2. result - id,
What does a 0 state mean? Failed? And a 1 state? Passed?
Best,
Oliveiros
2012/1/14 Alok Thakur
> Dear All,
>
> I have two tables one contains details of user and other contains
> result. The details are:
> 1. UserTable - id, name, phone
> 2. result - id, question_id, user_id, status (0 or 1)
>
Dear All,
I have two tables one contains details of user and other contains
result. The details are:
1. UserTable - id, name, phone
2. result - id, question_id, user_id, status (0 or 1)
I want the list like this:
User Id Name Attended Failed Passed
but i could not find the way to do this
On Jan 12, 2012, at 23:31, John Tuliao wrote:
> Hi,
>
> I've been working on this for quite awhile now and don't seem to get the
> proper query.
>
> I have basically 4 tables.
>
> 1. Table john_test contains the numbers of the calls.
> 2. Table john_country contains the country with prefix.
Hi,
I've been working on this for quite awhile now and don't seem to get the
proper query.
I have basically 4 tables.
1. Table john_test contains the numbers of the calls.
2. Table john_country contains the country with prefix.
3. Table john_clients contains the clients and their sub_id's
pgsql-sql
主题: Re: [SQL] Query Timeout Question
On 12/09/2011 09:44 AM, feng.zhou wrote:
Hi
I set query timeout in code by using SQLSetStmtAttr ODBC API .
SQLSetStmtAttr( StatementHandle, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER)timeout, 0
) ;
SQLExecute(StatementHandle);
But I find this setting h
On 12/09/2011 09:44 AM, feng.zhou wrote:
Hi
I set query timeout in code by using SQLSetStmtAttr ODBC API .
SQLSetStmtAttr( StatementHandle, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER)timeout, 0 )
;
SQLExecute(StatementHandle);
But I find this setting has no effect.Before adding timeout setting,
SQLEx
sorry, timeout is 15 seconds
2011-12-09
feng.zhou
发件人: feng.zhou
发送时间: 2011-12-09 09:25:49
收件人: pgsql-sql
抄送:
主题: [SQL] Query Timeout Question
Hi
I set query timeout in code by using SQLSetStmtAttr ODBC API .
SQLSetStmtAttr( StatementHandle, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER
Hi
I set query timeout in code by using SQLSetStmtAttr ODBC API .
SQLSetStmtAttr( StatementHandle, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER)timeout, 0
) ;
SQLExecute(StatementHandle);
But I find this setting has no effect.Before adding timeout setting, SQLExecute
costs 47 seconds.After adding timeou
00ms for ltree based vs 1.5 seconds for WITH RECURSIVE). I
could do the sorting in the php code, but it seems more efficient if I
can just do it all in a single SQL query.
tgre Novice
Cc: pgsql-sql@postgresql.org
Sent: Mon, December 7, 2009 7:23:19 PM
Subject: Re: [SQL] Query Performance
Yes, the problem is the nested loop scan - it's scanning users 609070
times, which is awful.
Could you provide explain plan that executed fast? Was it executed with
the same
Yes, the problem is the nested loop scan - it's scanning users 609070
times, which is awful.
Could you provide explain plan that executed fast? Was it executed with
the same parameter values or did the parameters change (maybe it's slow
for some parameters values only)?
Have you tried to rewrite
Hello List,
I have a query which use to run very fast now has turn into show stopper .
PostgreSQL:8.2
explain analyze select user_name,A.user_id, dnd_window_start, dnd_window_stop,
B.subs as subs, B.city_id as city_id, B.source_type as source_type from
The bitmask allows the setting of multiple permissions but the table
definition doesn't have to change (well, so long as the bits fit into a
word!) Finally, this is a message forum - the actual code itself is
template-driven and the bitmask permission structure is ALL OVER the
templates; gettin
Tom Lane wrote:
> Karl Denninger writes:
>
>> The problem appearsa to lie in the "nested loop", and I don't understand
>> why that's happening.
>>
> It looks to me like there are several issues here.
>
> One is the drastic underestimate of the number of rows satisfying the
> permission con
Karl Denninger writes:
> The problem appearsa to lie in the "nested loop", and I don't understand
> why that's happening.
It looks to me like there are several issues here.
One is the drastic underestimate of the number of rows satisfying the
permission condition. That leads the planner to think
Kevin Grittner wrote:
> Karl Denninger wrote:
>
>>-> Index Scan using forum_name on forum
>> (cost=0.00..250.63 rows=1 width=271) (actual time=0.013..0.408
>> rows=63 loops=1)
>> Filter: (((contrib IS NULL) OR (contrib = '
>> '::text) OR (contrib ~~ '%b%':
Karl Denninger wrote:
>-> Index Scan using forum_name on forum
> (cost=0.00..250.63 rows=1 width=271) (actual time=0.013..0.408
> rows=63 loops=1)
> Filter: (((contrib IS NULL) OR (contrib = '
> '::text) OR (contrib ~~ '%b%'::text)) AND ((permission & 127) =
Karl Denninger wrote:
> Let's take the following EXPLAIN results:
We could tell a lot more from EXPLAIN ANALYZE results.
The table definitions (with index information) would help, too.
-Kevin
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscripti
First query:
ticker=# explain analyze select * from post, forum where forum.name =
post.forum and invisible <> 1 and to_tsvector('english', message) @@
to_tsquery('violence') order by modified desc limit 100;
QUERY
PLAN
Let's take the following EXPLAIN results:
ticker=# explain select * from post, forum where forum.name = post.forum
and invisible <> 1 and to_tsvector('english', message) @@
to_tsquery('violence') order by modified desc limit
100;
"John Lister" writes:
Am I right in assuming the planner thinks a sequential scan is quicker
than 10k index hits, would tweaking the costs fix this or would i be
better updating the stats for the product_id and manufacturer_id fields?
AFAICT the planner did exactly the right things here. You
"John Lister" writes:
> Am I right in assuming the planner thinks a sequential scan is quicker than
> 10k index hits, would tweaking the costs fix this or would i be better
> updating the stats for the product_id and manufacturer_id fields?
AFAICT the planner did exactly the right things here.
Doing the following query
select distinct m.id, m.name
from manufacturer_manufacturer m
join product_product p on (p.manufacturer_id=m.id)
join retailer_offer o on (o.product_id=p.id)
where o.retailer_id=XXX and o.active
results in one of 2 query plans depending upon the v
customerfirstname,
> >> customerid, customerlastname, customermiddleinitial, customerphone,
> >> customerreferredby, customerstateabbr, customerstreet1, customerstreet2,
> >> customersuffix, customertitle, customerworkphone, customerworkphoneext,
> >> customerzip FROM lanemanage
>>
>> Please tell me is it work for you.
>>
>> Regards
>> Hidayat
>>
>> - Original Message -
>> From: "landsharkdaddy"
>> To:
>> Sent: Monday, April 27, 2009 9:19 PM
>> Subject: Re: [SQL] Query with Parameters and
ers WHERE (customerlastname ILIKE $1 ||
> '%')
> $$
> LANGUAGE SQL;
>
> Please tell me is it work for you.
>
> Regards
> Hidayat
>
> - Original Message -
> From: "landsharkdaddy"
> To:
> Sent: Monday, April 27, 2009 9:19 PM
> S
(customerlastname ILIKE $1 ||
'%')
$$
LANGUAGE SQL;
Please tell me is it work for you.
Regards
Hidayat
- Original Message -
From: "landsharkdaddy"
To:
Sent: Monday, April 27, 2009 9:19 PM
Subject: Re: [SQL] Query with Parameters and Wildcards
>
> When I try the foll
When I try the following like you suggested I get an error that says
"operator does not exist: || unknown
SELECT customercellphone, customercity, customerdatecreated,
customerdatelastmodified, customeremail, customerfax, customerfirstname,
customerid, customerlastname, customermiddleinitial, cu
landsharkdaddy wrote:
I have not tried that but I will in the morning. The @ in SQL is used to
indicate a parameter passed to the query. In PostgreSQL it seems that the :
is the same as the @ in SQL Server. I tried something like:
SELECT * FROM Customers WHERE FirstName LIKE :custfirst + '%';
I have not tried that but I will in the morning. The @ in SQL is used to
indicate a parameter passed to the query. In PostgreSQL it seems that the :
is the same as the @ in SQL Server. I tried something like:
SELECT * FROM Customers WHERE FirstName LIKE :custfirst + '%';
And it told me th
On Sun, Apr 26, 2009 at 6:21 PM, landsharkdaddy
wrote:
>
> I have a query that works on SQL Server to return customers that contain the
> string entered by the user by accepting parameters and using the LIKE
> keyword. I would like to move this to postgreSQL but I'm just not sure how
> to get it d
On Apr 26, 2009, at 7:21 PM, landsharkdaddy wrote:
I have a query that works on SQL Server to return customers that
contain the
string entered by the user by accepting parameters and using the LIKE
keyword. I would like to move this to postgreSQL but I'm just not
sure how
to get it done.
I have a query that works on SQL Server to return customers that contain the
string entered by the user by accepting parameters and using the LIKE
keyword. I would like to move this to postgreSQL but I'm just not sure how
to get it done. This is the query
SELECT * FROM Customers WHERE FirstName
"Bart van Houdt" <[EMAIL PROTECTED]> writes:
> I am working on a query to retrieve all indexed columns and came up with
> the following query:
> ...
> Tis query works for single column indexes, but with multiple column
> indexes I get incorrect results... I'm having a hard time figuring out
> how t
Hi,
I am working on a query to retrieve all indexed columns and came up with
the following query:
select pgc.relname as indexname
,pgc2.relname as tablename
,pga.attname as columnname
,pga.attnum as columnnumber
,replace(pgi.indkey::text, ' ', ',') as columnindex
sub3 napisal 14.11.2008 20:12:
Hi,
I was hoping someone could help me build a better query. I have a table of
time/locations. Occasionally, we have multiple timestamps for the same
location. I would like to remove those extra timestamps and only show the
transition from one location to anothe
Hi,
I was hoping someone could help me build a better query. I have a table of
time/locations. Occasionally, we have multiple timestamps for the same
location. I would like to remove those extra timestamps and only show the
transition from one location to another. So...
create table time_loca
Richard Huxton wrote:
> Do you have an index on (id,dt_modified) for manage_followup? Can you
> provide an EXPLAIN ANALYSE for this?
> Hi Richard,
>
> Firstly, thank-you very much for your swift reply. To answer your
> question,
> I had not been using an index on dt_modfied. I have added it now
Cheers for you help guys. Having filtered and then joined has substantially
reduced the run time.
Much obliged,
Sebastian
On Mon, Nov 10, 2008 at 12:32 PM, Richard Huxton <[EMAIL PROTECTED]> wrote:
> Sebastian Ritter wrote:
> > Could it have something
> > to do with the fact that it is a subquer
Sebastian Ritter wrote:
> Could it have something
> to do with the fact that it is a subquery and thus the planner can not
> deduce filtering conditions from the outer query against it? My apologises
> if that made no sense.
Could make a difference.
> In summary, what im trying to understand is t
Cheers for this Richard. The more I think about it, I believe the join is
being made against ALL issues and followups first and then filtered by my
where clause conditions afterwards. This would in incur a scan against all
15,000 issues and 95,000 followups. Set theory tells me that I should not
us
Hi Helio,
Sorry about the parenthesis - Bad copy/pasting skills! To further discuss
your suggestion: Wouldn't adding n_issue=i.id as a where clause filter cause
the sub-query to become correlated and thus much less efficient ? I may be
wrong, or may have miss-understood your suggestion.
Thanks fo
Hi Sebastian,
- First of all i think there is an open-parenthesis missing in the query
V2.
Maybe in the V2 version you cold restrict the results in the INNER query a
bit more if you use a restriction clause like "WHERE n_issue = i.id" in
that. It will certainly lower the number of rows returned b
Sebastian Ritter wrote:
> A lot of the reports our technical officers submit to us include a listing
> of all actioned issues for a given day along with the last modified followup
> of each said issue. With the number of rows in our database increasing at a
> high rate, these queries are starting t
Hi all,
I was hoping to receive some advise on a slow running query in our business'
Issue Tracking System. To shed some light on the below mentioned queries,
here is a brief summary of how users interact with the system. The two main
components in the system are a Issues and Followups. An Issue i
"Kevin Duffy" <[EMAIL PROTECTED]> writes:
> Can someone explain why the NULL ISINs in Security is causing
> so much grief? I do not get it.
NULL generally is taken as "unknown" in SQL comparisons. So if you have
any nulls in the output of the sub-select, what the upper select sees
is a situatio
On Wednesday 29 October 2008 21:56:14 Kevin Duffy wrote:
>
> Gentlemen:
>
> Thanks so much for your assistance.
>
> This returns 512 rows.
> select * from tmp_index_member tim
> where tim.ISIN NOT IN
> (select ISIN from security sec
> where ISIN is NOT NULL and
>securitytype
the NULL ISINs in Security is causing
so much grief? I do not get it.
KD
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Joseph
Krogh
Sent: Wednesday, October 29, 2008 3:58 PM
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] simple SQL query
On Wednesday 29 October 2008 18:39:42 Kevin Duffy wrote:
> Hello:
>
>
>
> I have a couple of queries that are giving me headaches.
>
> They are actually very simple, but I do not understand why
>
> I am not getting the expected results. Maybe I need new glasses.
>
> Please be kind.
>
>
Hello:
I have a couple of queries that are giving me headaches.
They are actually very simple, but I do not understand why
I am not getting the expected results. Maybe I need new glasses.
Please be kind.
The table definitions are below.
The table TMP_INDEX_MEMBER contains 21057 row
this was silly from me!
this should naturally look like this:
select case when status ='Closed' then stop_date else start_date end
as adate,
sum(case when status ='Closed' then 1 else 0 end) as
closedCount,
sum(case when status ='New' then 1 else 0 end) as openedCount
fro
Hi,
What about something like that ?
select adate, sum(openedCount) as openedCount, sum(closedCount) as closedCount
from
(
select sum(case when status ='Closed' then stop_date else start_date end) as
adate,
sum(case when status ='Closed' then 1 else 0 end) as closedCount
sum(cas
Montaseri wrote:
Given table T1 and columns id, start_date, stop_date and status, propose
a query that reports count of items opened and closed . status is an
enum including NEW, xxx, , CLOSED. The first status of an item is
NEW (could be used in place of start_date)
For example
Date
On Thu, Oct 2, 2008 at 1:49 PM, Montaseri <[EMAIL PROTECTED]> wrote:
> I was wondering if you can help me with the following query.
>
> Given table T1 and columns id, start_date, stop_date and status, propose a
> query that reports count of items opened and closed . status is an enum
> including NE
Hi,
I was wondering if you can help me with the following query.
Given table T1 and columns id, start_date, stop_date and status, propose a
query that reports count of items opened and closed . status is an enum
including NEW, xxx, , CLOSED. The first status of an item is NEW (could
be used i
Similar to \dt to show all tables, within one session, may I know the
command to list all prepared query plan please?
select * from pg_prepared_statements;
Thank you! I think this is the command.
Too bad that I could not use it under 8.0x.
select * from pg_prepared_statements;
ERROR: rela
Emi Lu wrote:
> Similar to \dt to show all tables, within one session, may I know the
> command to list all prepared query plan please?
select * from pg_prepared_statements;
--
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt,
Tom Lane wrote:
Emi Lu <[EMAIL PROTECTED]> writes:
Somebody know about how to find prepared query plan through command line?
PREPARE fooplan(...)
EXPLAIN EXECUTE fooplan(...)
Thank you Tom.
Similar to \dt to show all tables, within one session, may I know the
command to lis
Emi Lu <[EMAIL PROTECTED]> writes:
> Somebody know about how to find prepared query plan through command line?
PREPARE fooplan(...)
EXPLAIN EXECUTE fooplan(...)
regards, tom lane
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make change
Good morning,
May I know the "commands" to
. show current session's prepared plans
. see the definition of a prepared plan
E.g., psql> PREPARE fooplan (int, text, bool, numeric) AS INSERT INTO
foo VALUES($1, $2, $3, $4);
(1) Similar to "\dt", I want to see "fooplan"
(2) Similar to "\d table
Good morning,
May I know the "commands" to
. show current session's prepared plans
. see the definition of a prepared plan
E.g., psql> PREPARE fooplan (int, text, bool, numeric) AS INSERT INTO
foo VALUES($1, $2, $3, $4);
(1) Similar to "\dt", I want to see "fooplan"
(2) Similar to "\d tableNa
David Garamond wrote:
Dear SQL masters,
The query for "latest price for each product" goes like this (which I
can grasp quite easily):
SELECT * FROM price p1
WHERE ctime=(SELECT MAX(ctime) FROM price p2 WHERE p1.product_id=p2.product_id)
or:
SELECT * FROM price p1
WHERE NOT EXISTS (SELECT
> The query for "latest price for each product" goes like this (which I
> can grasp quite easily):
>
> SELECT * FROM price p1
> WHERE ctime=(SELECT MAX(ctime) FROM price p2 WHERE
> p1.product_id=p2.product_id)
>
> or:
>
> SELECT * FROM price p1
> WHERE NOT EXISTS (SELECT * FROM price p2 WHERE
Dear SQL masters,
The query for "latest price for each product" goes like this (which I
can grasp quite easily):
SELECT * FROM price p1
WHERE ctime=(SELECT MAX(ctime) FROM price p2 WHERE p1.product_id=p2.product_id)
or:
SELECT * FROM price p1
WHERE NOT EXISTS (SELECT * FROM price p2 WHERE
p
Thanks Stephan,
My real DDL include a forign key reference to T2.id and since I am ok with
NULL value then the "left outer join" indeed have solved the problem.
Thanks again
Medi
On Thu, May 22, 2008 at 2:50 PM, Stephan Szabo <[EMAIL PROTECTED]>
wrote:
> On Thu, 22 May 2008, Medi Montaseri wrot
On Thu, 22 May 2008, Medi Montaseri wrote:
> Hi,
> I can use some help with the following query please.
>
> Given a couple of tables I want to do a JOIN like operation. Except that one
> of the columns might be null.
>
> create table T1 ( id serial, name varchar(20) );
> create table T2 ( id seria
Hi,
I can use some help with the following query please.
Given a couple of tables I want to do a JOIN like operation. Except that one
of the columns might be null.
create table T1 ( id serial, name varchar(20) );
create table T2 ( id serial, name varchar(20) );
create table T1_T2 ( id serial, t1_
On Fri, 2008-05-16 at 09:21 -0600, Scott Marlowe wrote:
> On Thu, May 15, 2008 at 12:00 AM, <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > select count(distinct(j.JOBID)) as jobCount
> > from JOB_TYPE_FIRST a, JOB_TYPE_SECOND b, JOB_ALLOCATION_WORKLIST j
> > where (( a.JOBID = j.JOBID)
> > and (a.BO
On Thu, May 15, 2008 at 12:00 AM, <[EMAIL PROTECTED]> wrote:
> Hi,
>
> select count(distinct(j.JOBID)) as jobCount
> from JOB_TYPE_FIRST a, JOB_TYPE_SECOND b, JOB_ALLOCATION_WORKLIST j
> where (( a.JOBID = j.JOBID)
> and (a.BOOK_ID = :bookId))
> or ((b.JOBID = j.JOBID)
> and (b.BOOK_ID = :bookId)
Hi kapil,
Here you have specified 3 tables, does JOB_TYPE_FIRST and JOB_TYPE_SECOND
both contain all the JOBID in the third table?
Maybe i can help you if you elaborate your problem a bit more.
Regards,
Moiz Kothari
On Thu, May 15, 2008 at 11:30 AM, <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
>
>
Hi,
I have a query which is run across 3 tables JOB_TYPE_FIRST,
JOB_TYPE_SECOND and JOB_ALLOCATION_WORKLIST.
The column JOBID is referenced in JOB_ALLOCATION_WORKLIST table and
primary key in both JOB_TYPE_FIRST, JOB_TYPE_SECOND tables.
There is one more column BOOK_ID which is supplied
Emi Lu wrote:
> Can someone suggestion some tutorial/hyperlinks/docs about how
> postgresql output query results into xml files?
http://www.postgresql.org/docs/8.3/static/functions-xml.html#FUNCTIONS-XML-MAPPING
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your
Hello,
Can someone suggestion some tutorial/hyperlinks/docs about how
postgresql output query results into xml files?
Thanks a lot!
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org
Dear Shane,
Thanks for the reply and your observation about the
word i have used. It is idle odometer reading.
The actual Scenario is that the vehicle is taken by
the driver.
When he comes the next day. He is suppose to login
again.
Here i am trying to find out how much distance has the
vehic
1 - 100 of 598 matches
Mail list logo