Table name = Table-Name
ID Status description Tracking ID
1 Strat Frog 1
2 Start Dog 2
3 Process Frog 1
4 Completed Dog 2
5 Start Rabbit 3
6 Error Frog 1
7 Stop Rabbit 3
8 Start Elephant 4
9 process Elephant 4
10 Start Human 5
11 Stop Human 5
12 Start Butterfly 6
13 completed Butterfly 6
14 start lion 7
15 error lion 8
16 complted lion 8
17 start tiger 9
18 error tiger 9
Result should be " Frog and Elephant and tiger"
- Start of every record(descrpition --status is Start)
- End of every record ( status is stop or done or completed) status process is in between (their will be mulitple records with name s//y to process...ie. process 1 ...process 2...process 3 )
Query:
select *
from Table-Name
where datetime < to_date('2012/12/06:06:00:00', 'yyyy/mm/dd:hh24:mi:ss') And datetime > to_date('2012/12/04:22:00:00', 'yyyy/mm/dd:hh24:mi:ss')
And not description in (Select *
from Table-Name
where (Status like '%Complete%' or Status like '%stop%')
and description in (Select description
from Table-Name
where Status Like '%start%'));
Note:
tracking IDs may change up on error
s//yis supposed to mean. I'm not sure whytigerwould be returned since it only has astartand anerrorrow. Should we ignore the fact that you're mixing the case of yourstatusvalues-- you have bothStartandstartas well as the misspelledStrat. "Frog" also has noStoporCompletedrow, justStart,Process, andError. – Justin Cave Dec 17 '12 at 19:53Table name = Table-Name? – a_horse_with_no_name Dec 17 '12 at 20:00