Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7715211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:19:41+00:00 2026-06-01T02:19:41+00:00

I am wrangling with a query pulling unique values from 3 tables. Is this

  • 0

I am wrangling with a query pulling unique values from 3 tables. Is this better done in 2 separate queries?

the query is to:

count as returned (
all leadID from lds where status = "ok"
AND leadID is also in rlds with recID="999"
AND rdate > (03-20-2012)
 + 
(all distinct leadID from plds where recID="999"
AND change != NULL
AND pdate > (03-20-2012)) 

the result of the working query should be “2”: leadID 1 and leadID 4

table lds:

leadID | status
1 | ok
2 | bad
3 | ok

table plds:
leadID | recID | change | pdate
4 | 999 | ch1 | 03-27-2012
4 | 999 | ch2 | 03-27-2012
5 | 888 | NULL | 03-27-2012

table rlds:
leadID | recID2 | rdate
1 | 999 | 03-27-2012
6 | 999 | 03-27-2012

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:19:43+00:00Added an answer on June 1, 2026 at 2:19 am
    SELECT Ids.leadId
    FROM
        Ids JOIN
        rlds ON rlds.leadId = Ids.LeadId AND recID = 999 AND rdate > '03-20-2012'
    WHERE Ids.Status = 'ok'
    
    UNION
    
    SELECT leadId
    FROM pIds
    WHERE recID = 999 AND change IS NOT NULL AND pdate > '03-20-2012'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been wrangling with creating my own File Browser Content Provider for Telerik's FileExplorer
Ok...so ive been wriggling around with this piece of cod for quite a while
I'm wrangling with issues regarding how character equipment and attributes are stored within my
I'm a SWT newbie and am having some trouble wrangling my UI to look
I am currently doing a lot of data wrangling. I ingest a lloonngg NSData
I'm writing a class-library (IE BHO) in C# and currently wrangling with the large
I'm using the MSHTML API from C# 4.0 and the logistics of running code
I am running Windows 7, and am not usually a developer in this setting,
I'm doing a bit of UIView wrangling and am stuck. It is straightforward changing
I am so very tired of wrangling around with XCode 4's quirk's with regards

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.