-
multiple column query - probably simple for one who knows!
Simple question:
I am handling an oracle sql database and one of my table combines multiple fields (defined as field_name, field_value) from workflows which are defined in another table.
So something similar like this:
(workflow, field_name, field_value):
(1, field1, 'Monday')
(1, field2, 'Tuesday')
(1, field3, 'Wednesday')
what kind of sql query do I have to use that a similar to the following occures:
1, 'Monday', 'Tuesday'
Sorry to bother you, but I (as an SQL beginner) would very much appreciate your comment.
-
Try this
select workflow,
max(decode(field_name,'field1',field_value,''),
max(decode(field_name,'field2',field_value,''),
max(decode(field_name,'field3',field_value,'')
from yourtable
group by workflow
-
Shailesh Khanal,
thanks a lot, it worked!
Can you recommend an internet page where this sort of code is described in detail ?? All book/page available to me, handling only basic stuff. So, any recommendation?
Thanks a lot in advance.
Tim.
-
If you have access to metalink.oracle.com, it is a good source.
Otherwise you can go to
technet.oracle.com
lazydba.com
dbazine.com
-
all oracle documentation can be found at
http://tahiti.oracle.com/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|