consolidate results

Results 1 to 2 of 2

Thread: consolidate results

  1. #1
    Join Date
    Dec 1969

    Default consolidate results

    I have the follwing query: <BR><BR>SELECT nodePairA, nodePairB <BR>FROM Tree2TreePair <BR>WHERE (nodePairA = &#039;A08&#039;) OR <BR>(nodePairB = &#039;A08&#039;) <BR><BR>results: <BR><BR>nodePairA nodePairB <BR>A08 A0B <BR>A08 A10 <BR>A08 A16 <BR>A08 A18 <BR>A08 A22 <BR>A21 A08 <BR>A20 A08 <BR><BR>I want to end up with a single column with any set that has A08 in it, so I wound end up with: <BR><BR>ConsolidatedPair <BR>A0B <BR>A10 <BR>A16 <BR>A18 <BR>A22 <BR>A21 <BR>A20 <BR><BR><BR>Thanks in Advance!

  2. #2
    Join Date
    Dec 1969

    Default Need a UNION

    SELECT nodePairA AS ConsolidatedPair<BR>FROM Tree2TreePair <BR>WHERE (nodePairA = &#039;A08&#039;) OR (nodePairB = &#039;A08&#039;) <BR>UNION <BR>SELECT nodePairB AS ConsolidatedPair<BR>FROM Tree2TreePair <BR>WHERE (nodePairA = &#039;A08&#039;) OR (nodePairB = &#039;A08&#039;) <BR><BR>By default, using a UNION like that should give you only the unique values (no repeats). That may depend on the DB you are using, so if you get repeats, check your DB&#039;s docs to see if you need to use another keyword after UNION.<BR>

Posting Permissions

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