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 989797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:50:58+00:00 2026-05-16T05:50:58+00:00

I have two tables tabData and tabDataDetail. I want all idData(PK) from Parent-Table(tabData) that

  • 0

I have two tables tabData and tabDataDetail.
I want all idData(PK) from Parent-Table(tabData) that have only rows in Child-Table(tabDataDetail, FK is fiData) with:

  • fiActionCode=11 alone
    or
  • fiactionCode=11 and fiActionCode=34

Any other combination is invalid. How to get them?

What i’ve tried without success(slow and gives me also rows that have only fiActioncode 34) :

alt text
(source: bilder-hochladen.net)

Thanks for your Time.


EDIT: Thanks to all for their answers. Now i unfortunately have not enough time to check which one is best or works at all. I marked the first working one as answer.

EDIT2: i think that the marked answer is really the most efficient and compact solution.

EDIT3: Codesleuth’s answer is interesting because it returns only rows than have only a single fiActionCode=11. Difficult to see, because that its only true for 20 tabDataDetail-rows ot of 41524189 total-rows that have two. Anyway that was not 100% what i’ve asked or rather what i was looking for.

  • 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-05-16T05:50:58+00:00Added an answer on May 16, 2026 at 5:50 am
    Select ...
    From tabData As T1
    Where Exists    (
                    Select 1
                    From tabDataDetail As TDD1
                    Where TDD1.fiData = T1.idData
                        And TDD1.fiactionCode = 11
                    )
        And Not Exists    (
                          Select 1
                          From tabDataDetail As TDD1
                          Where TDD1.fiData = T1.idData
                              And TDD1.fiactionCode Not In(11,34)
                        )
    

    To expand on my logic, the first check (a correction) is to ensure that a row with fiActionCode = 11 exists. The second check works by first defining the set of rows we do not want. We do not want anything that is something other than fiActionCode = 11 or 34. Because that is the set of items we do not want, we search for anything that does not exist in that set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, I want to transfer all data from the first table
I have two tables like Parent-Child. In Parent table, there are 7211 records. In
I have two tables that I want to join into one table and use
I have two tables connected with one to many relationship. Parent Table is a
I have two tables that are all the same, except one has a timestamp
I have two tables: A, B. I need to select all data from B.
I have two tables and want to compare rows on sqlite like this table1
I have two tables in my MySQL database (table1 and table 2). I want
I have two tables that I want to use for viewing my reports which
I have two tables, users and visits. I want to select all users who

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.