[SQL] simple web search

2007-02-23 Thread Louis-David Mitterrand
Hello, I'm considering implementing a search box on my review web site http://lesculturelles.net and am looking for a simple way to match entered words against several columns on related tables: show.show_name, story.title, person.firtname, person.lastname, etc. What is the most elegant way

Re: [SQL] simple web search

2007-02-23 Thread chester c young
I'm considering implementing a search box on my review web site http://lesculturelles.net and am looking for a simple way to match entered words against several columns on related tables: show.show_name, story.title, person.firtname, person.lastname, etc. one solution would be a view:

Re: [SQL] simple web search

2007-02-23 Thread Louis-David Mitterrand
On Fri, Feb 23, 2007 at 10:01:22AM -0800, chester c young wrote: I'm considering implementing a search box on my review web site http://lesculturelles.net and am looking for a simple way to match entered words against several columns on related tables: show.show_name, story.title,

Re: [SQL] simple web search

2007-02-23 Thread chester c young
create view search_v as select 'show'::name as tab_nm, show_id as tab_pk, 'Show Name' as description, show_name as search from show union select 'story'::name, story_id, 'Story Title', title from story union ... What is that ::name cast for?

Re: [SQL] simple web search

2007-02-23 Thread Joe
Hello Louis-David, On Fri, 2007-02-23 at 17:27 +0100, Louis-David Mitterrand wrote: I'm considering implementing a search box on my review web site http://lesculturelles.net and am looking for a simple way to match entered words against several columns on related tables: show.show_name,

Re: [SQL] simple web search

2007-02-23 Thread Oleg Bartunov
I think contrib/tsearch2 http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/ is what you need. Oleg On Fri, 23 Feb 2007, chester c young wrote: I'm considering implementing a search box on my review web site http://lesculturelles.net and am looking for a simple way to match entered words

Re: [SQL] simple web search

2007-02-23 Thread Louis-David Mitterrand
On Fri, Feb 23, 2007 at 01:31:14PM -0500, Joe wrote: Hello Louis-David, On Fri, 2007-02-23 at 17:27 +0100, Louis-David Mitterrand wrote: I'm considering implementing a search box on my review web site http://lesculturelles.net and am looking for a simple way to match entered words

Re: [SQL] simple web search

2007-02-23 Thread Oleg Bartunov
On Fri, 23 Feb 2007, Louis-David Mitterrand wrote: On Fri, Feb 23, 2007 at 01:31:14PM -0500, Joe wrote: Hello Louis-David, On Fri, 2007-02-23 at 17:27 +0100, Louis-David Mitterrand wrote: I'm considering implementing a search box on my review web site http://lesculturelles.net and am looking

[SQL] how do I to generate a sequence Range or Set of integer constants

2007-02-23 Thread Stefan Becker
dear SQL friends, What I want to do might be done differantly. Right now I can't think of another solution other than a select statement I would like to create a sequence range of integer constants. Join this sequence against a ID Range in a database and look for missing Id's. Another

[SQL] selecting random row values in postgres

2007-02-23 Thread Sumeet
Hi all, I'm trying to write a query to select random values from a set of 'GROUP BY' see the scenario below to understand the problem here (the actual problem cannot be discussed here so i'm taking an example scenario) Assume there is a table id | name | year_of_birth query: I want to

Re: [SQL] how do I to generate a sequence Range or Set of integer constants

2007-02-23 Thread A. Kretschmer
am Fri, dem 23.02.2007, um 19:25:35 +0100 mailte Stefan Becker folgendes: Now: Is there a syntax that allows for the following. create table XX (id int); insert into XX (select xx from 1 to 1000 of integers) Perhaps you are searching for generate_series(): test=*# select

Re: [SQL] how do I to generate a sequence Range or Set of integer constants

2007-02-23 Thread Scott Marlowe
On Fri, 2007-02-23 at 12:25, Stefan Becker wrote: dear SQL friends, What I want to do might be done differantly. Right now I can't think of another solution other than a select statement I would like to create a sequence range of integer constants. Join this sequence against a ID Range

Re: [SQL] how do I to generate a sequence Range or Set of integer constants

2007-02-23 Thread Joe
On Fri, 2007-02-23 at 19:25 +0100, Stefan Becker wrote: dear SQL friends, What I want to do might be done differantly. Right now I can't think of another solution other than a select statement I would like to create a sequence range of integer constants. Join this sequence against a ID

Re: [SQL] selecting random row values in postgres

2007-02-23 Thread Rajesh Kumar Mallah
On 2/24/07, Sumeet [EMAIL PROTECTED] wrote: Hi all, I'm trying to write a query to select random values from a set of 'GROUP BY' see the scenario below to understand the problem here (the actual problem cannot be discussed here so i'm taking an example scenario) Assume there is a table

Re: [SQL] selecting random row values in postgres

2007-02-23 Thread Sumeet
Thanks Buddy, really appreciate ur help on this problem solved... Is there any way this query can be optimized...i'm running it on a huge table with joins - Sumeet On 2/23/07, Rajesh Kumar Mallah [EMAIL PROTECTED] wrote: On 2/24/07, Sumeet [EMAIL PROTECTED] wrote: Hi all, I'm

Re: [SQL] selecting random row values in postgres

2007-02-23 Thread Rajesh Kumar Mallah
On 2/24/07, Sumeet [EMAIL PROTECTED] wrote: got itI just figured out that i dont need the ORDER BY clause even the first row selected by the 'DISTINCT ON' would solve the problem. Dear Sumeet, if order by is not done there is no certainty about which row gets selected. usually same

Re: [SQL] selecting random row values in postgres

2007-02-23 Thread Tommy Gildseth
Sumeet wrote: Thanks Buddy, really appreciate ur help on this problem solved... Is there any way this query can be optimized...i'm running it on a huge table with joins ORDER BY rand() is rather slow on large datasets, since the db has to actually generate a random value for each row

Re: [SQL] selecting random row values in postgres

2007-02-23 Thread Geoff Tolley
Tommy Gildseth wrote: Sumeet wrote: Thanks Buddy, really appreciate ur help on this problem solved... Is there any way this query can be optimized...i'm running it on a huge table with joins ORDER BY rand() is rather slow on large datasets, since the db has to actually generate a