Re: [SQL] Passing input to a view?

2007-05-09 Thread Phillip Smith
Remove the WHERE clause that specifies the date so the view includes all dates, then apply the WHERE clause when selecting the view. SELECT * FROMinvoiced_repairs WHERE invoiced_repairs.received_date BETWEEN '1 Jan 2007' AND '10 May 2007'; -Original Message- From:

Re: [SQL] Passing input to a view?

2007-05-09 Thread A. Kretschmer
am Thu, dem 10.05.2007, um 14:03:53 +0800 mailte Paul Lambert folgendes: > Is it possible to define a view to use input parameters rather than a > hard-wired value in a where clause? As far as i know, no. > Instead of having it set to 1-Jan-2007 and 10-May-2007 for the dates, > can I specify

[SQL] Passing input to a view?

2007-05-09 Thread Paul Lambert
Is it possible to define a view to use input parameters rather than a hard-wired value in a where clause? I.e. I have the following view: CREATE OR REPLACE VIEW invoiced_repairs AS SELECT ro_header.ro_number, ro_header.received_date, vehicles.vehicle_id, vehicles.model, vehicles.engine, vehicl

Re: [SQL] query to select a linked list

2007-05-09 Thread Robert Edwards
Hi Louis-David, I also have written a forum application using PostgreSQL. My schema has a "threadid" for each posting, which is actually also the "messageid" of the first posting in the thread, but that is irrelevant. I can then just select all messages belonging to that thread. The actual hie

Re: [SQL] query to select a linked list

2007-05-09 Thread Gregory Stark
"Scott Marlowe" <[EMAIL PROTECTED]> writes: > Are you sure the tablefunc functions, which include both connectby and > crosstab functions, aren't up to date with 8.2? They certainly are up > to 8.1, where I'm running them right now on my workstation. They built > for 8.2 and installed, but I hav

Re: [SQL] query to select a linked list

2007-05-09 Thread Scott Marlowe
On Wed, 2007-05-09 at 08:29, Aaron Bono wrote: > On 5/9/07, Louis-David Mitterrand <[EMAIL PROTECTED]> > wrote: > Hi, > > To build a threaded forum application I came up the following > schema: > > forum > -- > id_forum | integer

Re: [SQL] query to select a linked list

2007-05-09 Thread Scott Marlowe
On Wed, 2007-05-09 at 08:24, Gregory Stark wrote: > "Louis-David Mitterrand" <[EMAIL PROTECTED]> writes: > > > Each message a unique id_forum and an id_parent pointing to the replied > > post (empty if first post). > > > > How can I build an elegant query to select all messages in a thread? > >

Re: [SQL] query to select a linked list

2007-05-09 Thread Louis-David Mitterrand
On Wed, May 09, 2007 at 04:30:21PM +0200, Louis-David Mitterrand wrote: > On Wed, May 09, 2007 at 02:55:20PM +0200, Louis-David Mitterrand wrote: > > Hi, > > > > To build a threaded forum application I came up the following schema: > > > > forum > > -- > > id_forum | integer| not null defaul

Re: [SQL] query to select a linked list

2007-05-09 Thread Louis-David Mitterrand
On Wed, May 09, 2007 at 02:55:20PM +0200, Louis-David Mitterrand wrote: > Hi, > > To build a threaded forum application I came up the following schema: > > forum > -- > id_forum | integer| not null default nextval('forum_id_forum_seq'::regclass) > id_parent| integer| > subject | text | n

Re: [SQL] query to select a linked list

2007-05-09 Thread Achilleas Mantzios
Στις Τετάρτη 09 Μάιος 2007 15:55, ο/η Louis-David Mitterrand έγραψε: > Hi, > > To build a threaded forum application I came up the following schema: > > forum > -- > id_forum | integer| not null default > nextval('forum_id_forum_seq'::regclass) id_parent| integer| > subject | text | not nul

Re: [SQL] query to select a linked list

2007-05-09 Thread Aaron Bono
On 5/9/07, Louis-David Mitterrand <[EMAIL PROTECTED]> wrote: Hi, To build a threaded forum application I came up the following schema: forum -- id_forum | integer| not null default nextval('forum_id_forum_seq'::regclass) id_parent| integer| subject | text | not null message | text |

Re: [SQL] query to select a linked list

2007-05-09 Thread Louis-David Mitterrand
On Wed, May 09, 2007 at 02:24:22PM +0100, Gregory Stark wrote: > "Louis-David Mitterrand" <[EMAIL PROTECTED]> writes: > > > Each message a unique id_forum and an id_parent pointing to the replied > > post (empty if first post). > > > > How can I build an elegant query to select all messages in a

Re: [SQL] query to select a linked list

2007-05-09 Thread Gregory Stark
"Louis-David Mitterrand" <[EMAIL PROTECTED]> writes: > Each message a unique id_forum and an id_parent pointing to the replied > post (empty if first post). > > How can I build an elegant query to select all messages in a thread? You would need recursive queries which Postgres doesn't support. T

[SQL] query to select a linked list

2007-05-09 Thread Louis-David Mitterrand
Hi, To build a threaded forum application I came up the following schema: forum -- id_forum | integer| not null default nextval('forum_id_forum_seq'::regclass) id_parent| integer| subject | text | not null message | text | Each message a unique id_forum and an id_parent pointing to