Results 1 to 3 of 3

Thread: if and or

  1. #1
    Join Date
    Nov 2002
    Posts
    261

    if and or

    I need to verify a few statements before processing. If any of these statements are true I need to do something. I tried

    if exists (select patid from pat..patientallergies where patid = @patid and facid = @newfacid )
    or
    if exists (select patid from pat..reorders where patid = @patid and facid = @newfacid )
    or
    if exists (select patid from pat..ReorderDirections where patid = @patid and facid = @newfacid )
    begin

    However this syntax is not allowed. What would be the proper way to do this?

  2. #2
    Join Date
    Dec 2004
    Posts
    502
    Almost had it:

    if exists (select patid from pat..patientallergies where patid = @patid and facid = @newfacid )
    or
    exists (select patid from pat..reorders where patid = @patid and facid = @newfacid )
    or
    exists (select patid from pat..ReorderDirections where patid = @patid and facid = @newfacid )
    begin

  3. #3
    Join Date
    Nov 2002
    Posts
    261
    Duh, I missed the obvious. thanks, it must be Monday

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •