[SQL] Updatable view

2005-06-30 Thread M.D.G. Lange
I have been looking around to get an idea how to make RULES on a VIEW for INSERT , UPDATE and DELETE of a VIEW with an INNER JOIN. First the idea: There are 3 tables, those are related one way or another, combined in this view: pg_user (ok, it's a view really) tblcontacts (with contact informa

Re: [SQL] SQL Query question

2005-06-30 Thread Nick Stone
Thanks for the reply at least that explains it. Nick -Original Message- From: Richard Huxton [mailto:[EMAIL PROTECTED] Sent: 30 June 2005 12:22 To: Nick Stone Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] SQL Query question Nick Stone wrote: > Hi > > Whilst I'm not new to SQL I am r

Re: [SQL] ORDER records based on parameters in IN clause

2005-06-30 Thread Daryl Richter
M.D.G. Lange wrote: Another option would be: SELECT * FROM table WHERE id=2003 OR id=1342 OR id=799 OR id=1450; This should give you the results in the right order... Per the SQL Standard, the rows of a table have no ordering. The result of a SELECT is just a derived table. Assuming a row

Re: [SQL] SQL Query question

2005-06-30 Thread Richard Huxton
Nick Stone wrote: Hi Whilst I'm not new to SQL I am reasonably new to Postgres and as such I have a question on the following query: FROM "Terms" As tbl1 LEFT JOIN "SearchStore" As tbl2 ON tbl1."KeywordID" = tbl2."KeywordID" AND tbl2."StockID" = 1 Why does the above query work fine an

Re: [SQL] SQL Query question

2005-06-30 Thread Peter Eisentraut
Am Donnerstag, 30. Juni 2005 11:27 schrieb Nick Stone: > SELECT > tbl1."TermTypeID", > tbl1."ParentID", > tbl1."KeywordID", > tbl1."Term", > tbl2."KeywordID" > FROM > "Terms" As tbl1 LEFT JOIN > "SearchStore" As tbl2 ON tbl1."KeywordID" = tbl2."KeywordID" > WHERE > (

Re: [SQL] ENUM like data type

2005-06-30 Thread Peter Eisentraut
Am Donnerstag, 30. Juni 2005 00:55 schrieb Tom Lane: > It's not that hard to make your own type using the builtin textin and > textout functions, and then add just the functions you wish to provide. Implementing the "distinct type" feature of SQL would probably amount to something like that. Mig

Re: [SQL] ORDER records based on parameters in IN clause

2005-06-30 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > fair enough. but a simple order by id would never work. That was me, sorry, I must have been asleep when I wrote it. :) - -- Greg Sabino Mullane [EMAIL PROTECTED] PGP Key: 0x14964AC8 200506300636 http://biglumber.com/x/web?pk=2529DF6AB8F79407E944

[SQL] SQL Query question

2005-06-30 Thread Nick Stone
Hi Whilst I'm not new to SQL I am reasonably new to Postgres and as such I have a question on the following query: SELECT tbl1."TermTypeID", tbl1."ParentID", tbl1."KeywordID", tbl1."Term", tbl2."KeywordID" FROM "Terms" As tbl1 LEFT JOIN "SearchStore" As tbl2 ON tbl1."K

Re: [SQL] ENUM like data type

2005-06-30 Thread KÖPFERL Robert
|> > I disagree. In several relations (views of the world) one |needs to have a |> > hand full of well defined values while |> > integers or bools are not appropriate and strings are too |free form. |> > For example male female or true and false. Whilst the |second has a well |> > known type, ot

Re: [SQL] ORDER records based on parameters in IN clause

2005-06-30 Thread Dawid Kuroczko
On 6/30/05, M.D.G. Lange <[EMAIL PROTECTED]> wrote: > Another option would be: > SELECT * FROM table WHERE id=2003 OR id=1342 OR id=799 OR id=1450; > This should give you the results in the right order... I don't think so... create temporary table seq as select * from generate_series(1,20) as g(

Re: [SQL] ORDER records based on parameters in IN clause

2005-06-30 Thread M.D.G. Lange
Another option would be: SELECT * FROM table WHERE id=2003 OR id=1342 OR id=799 OR id=1450; This should give you the results in the right order... - Michiel Scott Marlowe wrote: On Wed, 2005-06-29 at 09:22, Russell Simpkins wrote: fair enough. but a simple order by id would never work.