在SQL中添加新的参数集

时间:2015-10-02 16:29:26

标签: sql oracle

我想删除'tele%'带有primary_facitlity = 0 ;

的每个部分名称

部分名称'tele'的主要设施为0和1,我希望将包含'tele'的部分作为部分和主要设施保留为1

SELECT *
FROM PRACTITIONER 
    INNER JOIN PRACTITIONER_ID_NUMBERS ON (practitioner_id_numbers.pract_id = practitioner.pract_id)
    INNER JOIN PRACTITIONER_FACILITIES ON (PRACTITIONER.PRACT_ID = PRACTITIONER_FACILITIES.PRACT_ID)
WHERE(((PRACTITIONER_ID_NUMBERS.documentname) like 'Radio%' 
        or (PRACTITIONER_ID_NUMBERS.documentname) like 'Fluoro%') 
        and ((PRACTITIONER_ID_NUMBERS.historical)=0))
AND PRACTITIONER_FACILITIES.CURRENT_STATUS = 'Current'
AND PRACTITIONER_FACILITIES.FACCODE = 'LA'
/* I would like to eliminate  every section name that has 'tele%' with a primary_facitlity = 0 */ 
--AND (PRACTITIONER_FACILITIES.SECTION_NAME not like 'tele%' and PRACTITIONER_FACILITIES.PRIMARY_FACILITY = 0)
/* The end statement above does not work*/
ORDER BY PRACTITIONER_FACILITIES.FACCODE;

1 个答案:

答案 0 :(得分:0)

我没有参加考试,但我认为这应该有效。添加此约束:

and (PRACTITIONER_FACILITIES.PRIMARY_FACILITY = 1 or PRACTITIONER_FACILITIES.SECTION_NAME not like 'tele%')