[SQL] Update help

2002-09-03 Thread [EMAIL PROTECTED]
Hi, Let say I have 2 Product table, both of them has columns ProductID and Price What is the update command if I want to update all Prices of first table to be equal with Price in second table?   Please Help.   Yudie

Re: [SQL] tree structures in sql - my point of view (with request

2002-09-03 Thread Bruce Momjian
[EMAIL PROTECTED] wrote: > > Yep! ltree is Fst , and i use it at the moment. > > But will it work in INGRES,DB2 or ORACLE ? > what if tommorow my boss ask me to use ORACLE? > > I have similar issues in using intarray & arrays in PGSQL > > though reasons of shifting to others dbs are dimin

Re: [SQL] tree structures in sql - my point of view (with request

2002-09-03 Thread mallah
Yep! ltree is Fst , and i use it at the moment. But will it work in INGRES,DB2 or ORACLE ? what if tommorow my boss ask me to use ORACLE? I have similar issues in using intarray & arrays in PGSQL though reasons of shifting to others dbs are diminishing with every major release of PG ;-)

Re: [SQL] Outer Join with For Update

2002-09-03 Thread Tom Lane
"alexandre :: aldeia digital" <[EMAIL PROTECTED]> writes: > SELECT A.id, B.desc from A left join B ON B.id=A.id FOR UPDATE OF A,B > If I have a null rellation in B, the error in postgres is: > "SELECT FOR UPDATE cannot be applied to the nullable side of an OUTER JOIN" Yup. > DB2 simply ignore th

Re: [SQL] Update Help

2002-09-03 Thread Peter Eisentraut
[EMAIL PROTECTED] writes: > Let say I have 2 Product table, both of them has columns ProductID and > Price What is the update command if I want to update all Prices of first > table to be equal with Price in second table? Possibly you mean something like this: UPDATE first_table SET price = (SE

Re: [SQL] UPDATE & LIMIT together?

2002-09-03 Thread Bruce Momjian
tp wrote: > Hmm,, > > thanks so far, it helped. > > The query is horrible slow on full tables (>100.000 rows). > Is there any other solution? I just want to have the 'next 10 entries' > WHERE state=10 and update state=20. > (so that on the next request i or another process only gets the > new e

Re: [SQL] tree structures in sql - my point of view (with request of comment from joe celko)

2002-09-03 Thread Josh Berkus
Hubert, > i recently spent some time on tree-structures in sql. > i started with simple id/parent_id approach, used by nearly everyone, > then i stopped at joe celko's nested sets, but i found it not very > usable. I'll be posting an article on implementing nested set trees "real soon now". My

[SQL] Outer Join with For Update

2002-09-03 Thread alexandre :: aldeia digital
Hi all, I work with a case tool named Genexus. This tool generate the applications in VB, VFox, Java, C, etc. in DB2, Oracle, M$ SQL and now supports postgresql in VB and JAVA generator, making a good job (excepting when it use a "optimize for", "/*fastfirstrows*/" or "fast(n)" for the other 3 DB

Re: [SQL] Update Help

2002-09-03 Thread Oliver Elphick
On Tue, 2002-09-03 at 17:38, [EMAIL PROTECTED] wrote: > Let say I have 2 Product table, both of them has columns ProductID and Price > What is the update command if I want to update all Prices of first table to be equal with Price in second table? UPDATE table1 SET price = (SELECT pric

Re: [SQL] tree structures in sql - my point of view (with request

2002-09-03 Thread Oleg Bartunov
While I don't have a time to comment your message I want to point to contrib/ltree package which is extremely fast :-) http://www.sai.msu.su/~megera/postgres/gist/ltree Oleg On Tue, 3 Sep 2002, Hubert depesz Lubaczewski wrote: > hi > i recently spent some time on tree-structures in sql.

[SQL] Update Help

2002-09-03 Thread [EMAIL PROTECTED]
Hi, Let say I have 2 Product table, both of them has columns ProductID and Price What is the update command if I want to update all Prices of first table to be equal with Price in second table?   Please Help.   Yudie

Re: [SQL] [GENERAL] Why must the function that a trigger calls return

2002-09-03 Thread Darren Ferguson
What would the trigger return the value too. You did not call the trigger the system called the trigger. Also triggers are not meant for use in this way they are meant for data manipulation before or after a table is inserted,updated or deleted. You would have to run select currval('seq_name')

[SQL] tree structures in sql - my point of view (with request of comment from joe celko)

2002-09-03 Thread Hubert depesz Lubaczewski
hi i recently spent some time on tree-structures in sql. i started with simple id/parent_id approach, used by nearly everyone, then i stopped at joe celko's nested sets, but i found it not very usable. then i found my own (maybe someone wrote it before, but i haven't read it, so idea is mine) way.

Re: [SQL] convert sum (interval) to seconds

2002-09-03 Thread Tom Lane
Oliver Elphick <[EMAIL PROTECTED]> writes: > On Tue, 2002-09-03 at 11:45, Doppelganger wrote: >> How can I convert sum(interval) to seconds? > Here's one way; > junk=# select extract (minute from sum(if)) * 60 + extract (second > from sum(if)) from i; EXTRACT(EPOCH FROM interval) is

Re: [SQL] RFC822 Checker

2002-09-03 Thread Hubert depesz Lubaczewski
On Fri, Aug 30, 2002 at 02:07:28PM +, Matthew Price wrote: > Does anyone know of an SQL function that will check a string for > compliance with the RFC822 mail address spec? I have a script that > sends mail from a db (no, I am not a spammer) but I often have mails > sitting in my queue becau

Re: [SQL] convert sum (interval) to seconds

2002-09-03 Thread Oliver Elphick
On Tue, 2002-09-03 at 11:45, Doppelganger wrote: > How can I convert sum(interval) to seconds? ... > If I say, > select sum(interval) from tablename where login='john'; > it will give me 00:45:28 (That's 45 mins, and 28 secs). > How can I convert that to seconds? Can I possibly do it > in just on

[SQL] convert sum (interval) to seconds

2002-09-03 Thread Doppelganger
How can I convert sum(interval) to seconds? select sum(interval_field) from tablename where condition=condition; ID | LOGIN | INTERVAL -- 1 | JOHN | 00:00:18 2 | JOHN | 00:45:10 If I say, select sum(interval) from tablename where login='john'; it will gi

Re: [SQL] UPDATE & LIMIT together?

2002-09-03 Thread tp
Hmm,, thanks so far, it helped. The query is horrible slow on full tables (>100.000 rows). Is there any other solution? I just want to have the 'next 10 entries' WHERE state=10 and update state=20. (so that on the next request i or another process only gets the new entires in queue). My query