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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:43:34+00:00 2026-06-09T21:43:34+00:00

I have two tables: task id name dueDate completed projectID project id name dueDate

  • 0

I have two tables:

task
id name dueDate completed projectID

project
id name dueDate completed

I need to query both tables for rows with the same data. I tried doing a sample statement just looking for rows with completed=0, but never got any results. I think it has to do with using OR instead of AND, but it’s just a little above my level right now…Any ideas?

TO CLARIFY, I’m not looking for duplicate rows, I’m looking for ‘all tasks and projects with completed = 0’

The query is:

SELECT * FROM "task" t, "project" p WHERE t.dueDate = "2012-08-17" OR p.dueDate = "2012-08-17" AND t.completed = 0 OR p.completed = 0

I did manage to get one of the answers’ code to work, however I realized that my entire app was written to talk to one table, and that it would be much easier to just combine the task and project table and use an isProject column to differentiate projects from tasks. This also adds the ability to nest projects inside of projects, because projects will now have a projectID column as well.

In the end, KISS prevails…

Thanks for all the help! I will mark the answer that worked, even though I won’t be using it.

  • 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-09T21:43:35+00:00Added an answer on June 9, 2026 at 9:43 pm

    Try this instead:

    SELECT dueDate, completed
    FROM task AS t 
    WHERE (dueDate = "2012-08-17" AND completed = 0)
    UNION ALL
    SELECT dueDate, completed
    FROM project AS p
    WHERE (dueDate = "2012-08-17" AND completed = 0)
    

    This should give you all records from each table where dueDate = "2012-08-17" and completed = 0.

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

Sidebar

Related Questions

I have two tables to be printed in same page. Data for those tables
I have two tables with the exact same columns. Both have primary identity keys
I have two tables, tasks and projects. And every task has a project (and
We have two tables - Tasks and TasksUsers (users assigned to task). Task has
I have two tables one with ID and NAME table 1 ID | NAME
I have two tables user table user_id | name | 1 | peter |
I have two tables, Tasks and TaskMilestones. I want a query to return the
I have two tables one named Person , which contains columns ID and Name
I have a two separate tables that contain parts of user name (don't ask
I have two tables. They're in a 1:N relationship. Tasks - Id - Name

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.