Results 1 to 2 of 2

Thread: Prioritizing

  1. #1
    Join Date
    Nov 2008
    Posts
    16

    Unanswered: Prioritizing

    Hi,
    I have an issue. Issue is i have data A set of data ,B set of data.

    I can insert A set of data into a table when some set of conditions match or B set of data into a table when some set of conditions match. But when i get combination of A and B both satisfying their set of conditions i should ignore the B set, i should take only A.

    In simple words :

    If A alone insert,
    B alone insert
    A and B , then ignore B even when its conditions match.

    Example :

    select count(1) into n_count from A, B, C
    where (
    (xyz=50 and YY ='XX')
    or(XYZ=230 and YY ='LL' and ZZ='D)
    or(XYZ=230 and YY ='FR')
    )
    and (status not in (2,5,6));


    Here i have to take the set of data.

    (xyz=50 and YY ='XX') or (XYZ=230 and YY ='LL' and ZZ='D) is one set
    and (XYZ=230 and YY ='FR') is other set. Now what my code does is either of the conditions satisfy data is pulled, but what i am looking for is

    (xyz=50 and YY ='XX') or (XYZ=230 and YY ='LL' and ZZ='D) = True pull data

    (XYZ=230 and YY ='FR') = True pull data


    (xyz=50 and YY ='XX') or (XYZ=230 and YY ='LL' and ZZ='D) or (XYZ=230 and YY ='FR') = true

    then pull data only for (xyz=50 and YY ='XX') or (XYZ=230 and YY ='LL' and ZZ='D)


    Can someone guide me how to proceed.


    Thanks in advance.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Try:
    Code:
    (  ((xyz=50 and YY ='XX') or (XYZ=230 and YY ='LL' and ZZ='D))
    or (   XYZ=230 and YY ='FR'
       and not ((xyz=50 and YY ='XX') or (XYZ=230 and YY ='LL' and ZZ='D))
       )
    )

Posting Permissions

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