Re: [SQL] Slow sub-selects, max and count(*)

2004-02-04 Thread Iain
Hi,   I don't think thatyou gave enough information to get any direct help, for example, what are these "sub-selects"?   I often see performance problems arising from procedural code that puts selects that don't use indexes inside loops. That's a plain programming issue, and understanding yo

Re: [SQL] Slow sub-selects, max and count(*)

2004-02-04 Thread Josh Berkus
Richard, > The issue is with the speed ( or lackof it) that the procedure proceeds. Apparently it is the subselects that are the worst issue and I have tried to replace these. Also max() and count() refuse to use indexes. Max() and Count() cannot use indexes for technical reasons. Browse thr

[SQL] Slow sub-selects, max and count(*)

2004-02-04 Thread Richard Sydney-Smith
I have a procedure ( included below with table definition) to import end of day quotes into a table fsechist.   The issue is with the speed ( or lackof it) that the procedure proceeds. Apparently it is the subselects that are the worst issue and I have tried to replace these. Also max() and c

Re: [SQL] TIME ZONE SQL

2004-02-04 Thread Richard Huxton
On Wednesday 04 February 2004 17:57, Raman wrote: > > This query runs fine when i have > time_difference value like +5:30 +5:00 i.e. works fine for positive values > but failes for negative values i.e. -7:00, -6:00 etc > > I don't know WHY WHY... pls help > I am helpless. Can you give example outp

[SQL] TIME ZONE SQL

2004-02-04 Thread Raman
Hi Pls see this Query I have following fields in my table "customer_events" a) time_difference (which has values like -05:00 , +05:30, +00:00 etc) b) start_time (has value like 11:05, 10:00 etc) c) send_before_time (has value like 00:05, 00:10 etc) select ((CURRENT_TIME(0) AT TIME ZONE "interva

Re: [SQL] Update from same table

2004-02-04 Thread Josh Berkus
Jurgen, > UPDATE a.mytable from b.mytable > SET a.mycolumn = b.mycolumn > WHERE a.firstid = some_key > AND b.firstid = some_other_key > AND a.secondaryid = b.secondaryid; Very close, actually; you just need to fix the table alias: UPDATE mytable FRO

[SQL] Update from same table

2004-02-04 Thread Jürgen Cappel
Hello, I want to update columns in a table that match a fixed key from the same column of the same table matching another fixed key. There can be several tuples per key distinguished by a secondary id. Tuples are unique with the combined keys. Maybe a query could look something like this:

Re: [SQL] SQL query

2004-02-04 Thread daq
PC> Hello, PC> I would like to retrieve all the records from table A which have given PC> lang_id and its modification date is later then modification date of PC> the same id record with lang_id='pl'. PC> Example: PC> table A - data example PC> == PC> id | modification_d