Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Help
<cmwatson_at_cal.ameren.com> a écrit dans le message de news: 1184182321.999728.9600_at_57g2000hsv.googlegroups.com...
| I've tried SQL to come up with the result below but am having no luck.
| Please, can someone help me!!!!!:) Believe me, any and all help will
| be greatly appreciated.
|
| What I need is the task_ids that have actv_code.short_name like '%FIN'
| where actv_code.code = 'Lead Craft' and no actv_code.code that equals
| Outage Code
|
| task table
| task_id task_code
| 1 W123456
| 2 07146566
| 3 07146567
| 4 06230001
| 5 06123321
| 6 06496334
| 7 W642121
| 8 05462111
|
| actv_code table
| task_id code short_name
| 1 Outage Code R16
| 4 Outage Code R15
| 6 Outage Code R16
| 1 Lead Craft ZFM
| 5 Lead Craft EFIN
| 6 Lead Craft MFIN
| 7 Lead Craft IFIN
| 8 Outage Code R16
| 8 Lead Craft MFIN
|
Just write it as you explain it:
select task_id
from actv_code a
where short_name like '%FIN'
and code = 'Lead Craft'
and not exists (select null from actv_code b where b.task_id = a.task_id and b.code = 'Outage Code')
/
Regards
Michel Cadot
Received on Wed Jul 11 2007 - 14:51:07 CDT
![]() |
![]() |