Re: CASE statement in MySQL

2006-12-22 Thread Josh Nathanson
> Sure looks like you're updating positions in a hierarchial collection > of help pages using nested sets, though the algorithm is a touch > different that what I've always used, and I can't say if it's a bug or > if it's just different. Winner winner, chicken dinner! This query is actually the u

Re: CASE statement in MySQL

2006-12-22 Thread Barney Boisvert
Sure looks like you're updating positions in a hierarchial collection of help pages using nested sets, though the algorithm is a touch different that what I've always used, and I can't say if it's a bug or if it's just different. However, I can tell you from experience that two sequential queries

Re: CASE statement in MySQL

2006-12-22 Thread Josh Nathanson
> There a lot of funny business going on in this SQL statement. I would try > to accomplish the logic outside the SQL statement. I you need > conditionals I would limited to statements any thing more than that > seems a little messy for lack of a better term. > Yup it is messy, but the advan

Re: CASE statement in MySQL

2006-12-22 Thread Josh Nathanson
CF-Talk" Sent: Friday, December 22, 2006 2:21 PM Subject: Re: CASE statement in MySQL > The CASE construct is an expression. The structure of the SQL > statement cannot be changed with a CASE construct, all you can do is > dynamically compute a value. To put that nother way, you can

Re: CASE statement in MySQL

2006-12-22 Thread Dwayne Cole
There a lot of funny business going on in this SQL statement. I would try to accomplish the logic outside the SQL statement. I you need conditionals I would limited to statements any thing more than that seems a little messy for lack of a better term. -- Original Message ---

Re: CASE statement in MySQL

2006-12-22 Thread Barney Boisvert
The CASE construct is an expression. The structure of the SQL statement cannot be changed with a CASE construct, all you can do is dynamically compute a value. To put that nother way, you can only use a CASE where you can use a value/expression. Instead of this (what you have): UPDATE myTable SE

CASE statement in MySQL

2006-12-22 Thread Josh Nathanson
Hey SQL gurus, I am trying to use a CASE statement in a MySQL query to conditionally update a number of rows in a table. However, if I try to use anything in the "THEN" clause other than a string, it fails with "Error in SQL syntax." I am trying to set values in the table differently depending