Re: [SQL] Storing an ordered list

2006-07-26 Thread Michael Artz
On 7/26/06, Bruno Wolff III <[EMAIL PROTECTED]> wrote: If you use numeric instead of int, then it is easy to insert new values. Hmm, hadn't thought about that. How would you normally implement it? I'm thinking that, if I wanted to insert between A and B, I could take (A.order + B.order)/2, whi

Re: [SQL] Storing an ordered list

2006-07-26 Thread Michael Artz
On 7/26/06, Aaron Bono <[EMAIL PROTECTED]> wrote: If you use the linked list, remember this: to reduce the updates you are going to need more code in the application as it will have to keep track of what to update and what to not update. It will also be more difficult to order the items using SQ

[SQL] Storing an ordered list

2006-07-25 Thread Michael Artz
What is the best way to store and ordered list that can be updated OLTP-style? A simplified problem is that I have an event, and the event has an ordered list of predicates and I need to preserve the order of the predicates. All of the data is entered via a web application, and I would like to s

Re: [SQL] Question about SQL Control Structure(if then, for loop)

2006-05-18 Thread Michael Artz
SELECT 'test' FROM SELECT 'test' FROM generate_series(1,10);Sorry, thought faster than I could type :)-Mike

Re: [SQL] Question about SQL Control Structure(if then, for loop)

2006-05-18 Thread Michael Artz
If you're control is that simple, you can write similar statements in pure SQL: RDM=# for i in 1 .. 10 loopRDM-# select "test"RDM-# end loop;ERROR:  syntax error at or near "for" at character 1LINE 1: for i in 1 .. 10 loop SELECT 'test' FROM RDM=# if exits ( select * from testtable)RDM-# thenRDM-#