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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:34:25+00:00 2026-06-03T20:34:25+00:00

I have a table with a boolean value and I want to find out

  • 0

I have a table with a boolean value and I want to find out if a group of id’s have both values.

This sql selects the group of products I want to test:

SELECT 
  cp.ItemID,
  cp.IsUnitsOfMeasure
from grouped_products gp
LEFT JOIN products p ON p.product_id = gp.product_id
LEFT JOIN c_products cp ON cp.ItemID = p.product_id
WHERE gp.group_id=123

I want to find out if cp.IsUnitsOfMeasure for the group contains both 1 and 0.

  • 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-03T20:34:26+00:00Added an answer on June 3, 2026 at 8:34 pm
    SELECT   gp.group_id,
             SUM(cp.IsUnitsOfMeasure=0) AND SUM(cp.IsUnitsOfMeasure=1) AS ContainsBoth,
    FROM     grouped_products AS gp
      LEFT JOIN products      AS  p USING (product_id)
      LEFT JOIN c_products    AS cp ON cp.ItemID = p.product_id
    GROUP BY gp.group_id
    

    ContainsBoth will be TRUE or FALSE to indicate whether or not each respective group contains both a c_product with IsUnitsOfMeasure=0 and another with =1.

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

Sidebar

Related Questions

I have a table which has essentially boolean values in a legacy database. The
i have a table column called status - data type is boolean. i want
I have a boolean column in one of my tables (value is either 0
I have an events table with a 'featureEvent' boolean column. I need to display
I have a boolean (BOOL) type field in the SQLite table. In the SubSonic
i have table structure with 3 colums (column1, column2, column3) and i want to
I have table with 3 columns A B C. I want to select *
I have a table model. I want to delete a row from a table.
I have this code in my Table model: public class DocumentProjectTableModel extends AbstractTableModel{ private
I have a query that updates a boolean value for a given record, then

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.