Re: [SQL] Quota query with decent performance?

2003-11-12 Thread Troels Arvin
On Tue, 11 Nov 2003 18:49:31 -0500, Chester Kustarz wrote: [... cut efficient top-3 youngest query wanted ...] > select * > from person > where age <= > (select age from person order by age limit 1 offset 2); Thanks - it works; why didn't I think of that? -- Greetings from Troels Arvin, Copenh

Re: [SQL] Quota query with decent performance?

2003-11-12 Thread Troels Arvin
On Tue, 11 Nov 2003 18:49:31 -0500, Chester Kustarz wrote: > select * > from person > where age <= > (select age from person order by age limit 1 offset 2); Integrated into http://troels.arvin.dk/db/rdbms/#select-top-n -- Greetings from Troels Arvin, Copenhagen, Denmark -

Re: [SQL] search facilities

2003-11-12 Thread Martin Kuria
Bartunov, Thanks alot for you reply, please clarify for me something; I have a database driven website developed using php and postgresql database, can I use tsearch facility and customize it to search my database driven website like how postgresql.org is search please do advice thanks again Ki

Re: [SQL] SQL substring

2003-11-12 Thread Franco Bruno Borghesi
... WHERE field1 LIKE '%' || field2 || '%' or ... WHERE position(field2 in field1)>0 On Wed, 2003-11-12 at 11:07, Guy Korland wrote: Hi, How can I compare two fields if one is a substring of the other? Something like: ... WHERE StringA like '%' + StringB + '%'; Thanks, Guy Korland --

Re: [SQL] SQL substring

2003-11-12 Thread Bruno Wolff III
On Wed, Nov 12, 2003 at 11:38:31 -0300, Franco Bruno Borghesi <[EMAIL PROTECTED]> wrote: > ... WHERE field1 LIKE '%' || field2 || '%' The first way won't work correctly if field2 has %s in it. > or > ... WHERE position(field2 in field1)>0 ---(end of broadcast)--

[SQL] SQL substring

2003-11-12 Thread Guy Korland
Hi, How can I compare two fields if one is a substring of the other? Something like: ... WHERE StringA like '%' + StringB + '%'; Thanks, Guy Korland ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropri

Re: [SQL] How to know column constraints via system catalog tables

2003-11-12 Thread Damon Chong
Thanks alot, you are right with the table and the -E option. It's very useful. The only issue I find with your SQL is it relies on "(a.attnum = x.conkey[1] or a.attnum = x.conkey[2])" which assumes there is two columns forming the primary key of a table. Perhaps, I should explain what I'm tryi

Re: [SQL] transaction processing after error in statement

2003-11-12 Thread Jan Wieck
Holger Jakobs wrote: Calling a procedure is a statement as well, and it includes all other procedures called from this procedure. So the statement level is always the statements that were carried out directly in the transaction. If anything within one statement fails, the statement was not carried

[SQL] Looks are important

2003-11-12 Thread George Weaver
Hi Everyone,   I am trying to concatenate two fields through a query:   SELECT RPAD(no,30,' ') || tableb.kind FROM tablea  WHERE tablea.kind = tableb.kind   The result gives (for example):   4595448   Green5966  Yellow106-60033   

Re: [SQL] Looks are important

2003-11-12 Thread Josh Berkus
George, > SELECT RPAD(no,30,' ') || tableb.kind FROM tablea > WHERE tablea.kind = tableb.kind Try SELECT RPAD(no, (35 - LENGTH(tableb.kind)), ' ') -- -Josh Berkus Aglio Database Solutions San Francisco ---(end of broadcast)--- TIP 7: don't fo

Re: [SQL] Looks are important

2003-11-12 Thread Louise Cofield
Title: Message Try the TRIM function or the LTRIM function:   SELECT RPAD(no,30,' ') || TRIM(tableb.kind) FROM tablea  WHERE tablea.kind = tableb.kind   Louise -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of George WeaverSent: Wednesday, Nov

Re: [SQL] Looks are important

2003-11-12 Thread George Weaver
Title: Message Hi Louise, Josh,   Thanks for the suggestions.   What I'm trying to accomplish is to have a space between no and kind.  Length(no) can vary.  I would like all the kinds to line up evenly when displayed, with a space between no and kind.  But when I RPAD no (to try and get an ev

Re: [SQL] Looks are important

2003-11-12 Thread Tom Lane
"George Weaver" <[EMAIL PROTECTED]> writes: > ... the ' 's are not quite the same width as= > an ordinary number or letter. Thus the physical display length of "30 cha= > racters" (padded) can vary from row to row. The result is that the kinds do= > n't necessary line up neatly. I need to concat