|Logic trouble [message #314445]
||Wed, 16 April 2008 13:30
Registered: April 2008
I have the query below but the case logic isn't working properly.
The view being used (CSS_TERM_GROUP_MOBILE_ID_MV) shows mobiles that are in a Terminal Group. These mobiles can be active or inactive.
The mobile_history table contains all of the mobiles(active or not) in a group or not but doesn't contain any info on the groups.
For example, there is a mobile in CSS_TERM_GROUP_MOBILE_ID_MV that is showing as not active (it has been end dated (is not null)), but in the mobile_history, it has an active status and it is actually active, but since it had been newly activated, it is no longer in the terminal group. How can i change my case logic or add conditions in my where clause that can indicate that this mobile and others like it in the list are active but are not in a terminal group?(My actual list has hundreds of mobiles)
SELECT imn AS Mobile,
mh.customer_code AS Customer,
terminal_group_code AS GroupCode,
wHEN v.end_date is null THEN 'Yes'
WHEN mH.EDATE > SYSDATE THEN 'Yes'
END ) active
FROM CSS_TERM_GROUP_MOBILE_ID_MV v,
WHERE IMN IN ('463662340','463701040','463701532','463792331','463663170',
AND mh.CUSTOMER_CODE = c.CUSTOMER_CODE
For the person who can answer this,
Thanks a million!!!!