This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Post a query of what you are trying to do. Sounds like you may be trying to do something like the following which i have done in sybase. You can also combine with the previous posters 'case' approach. I didn't try to run, but should work
1. Create a temp table (CREATE TEMPORARY TABLE temp SELECT ...) with calculated fields for the values we can't create with a single query or a UNION.
2. Then iterate over the temp table issuing queries to UPDATE the calculated fields using queries that would have been (seemingly) impossible to do with a single query. Here, we would read whatever fields from the temp table we need to create the UPDATE statements to fill in the calculated fields in the temp table.
3. Display results.
This approach would give you ultimate flexibility but would require a bit more work.
Joined: Jun 26, 2002
Post the sample implementation and it will be easier to make comments