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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:15:58+00:00 2026-06-13T22:15:58+00:00

I have tables A , B and C . Now table A as column

  • 0

I have tables A, B and C. Now table A as column A1(Primary Key), table B has column B1(Primary Key) and table C has columns A1(Foreign Key to Table A.A1), B1(Foreign Key to Table B.B1).

Now I’m writing a query which list all rows from A and B and a bit column which will be set to to 1 if a row is found matching in table C otherwise 0.

SELECT 
     ISNULL((SELECT CAST(1 AS BIT) 
             FROM C 
             WHERE C.A1 = A.A1 AND C.B1 = B.B1),0) AS [TAG],
     A.A1,
     B.B1
FROM A CROSS JOIN B

This query is producing an Subquery returned more than 1 value. error even though the query has no duplicate rows after combining the A1 and B1 columns.

  • 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-13T22:15:59+00:00Added an answer on June 13, 2026 at 10:15 pm

    try this,

    SELECT  CAST(COALESCE(c.b1, 0) AS BIT)   TAG
    FROM
            (
                SELECT  A1, B1
                FROM    A CROSS JOIN B
            ) D LEFT JOIN C
                    ON  c.A1 = d.A1 AND
                        c.B1 = D.B1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Model1.edmx, which has several tables. Now, I do not want all
I have data in two tables. The first table has a Primary Key called
I have a table (Table1) which has a composite primary key(Column1 + Column2). I
I have a mysql table which columns are post_id and post_msg. Now I want
I have a city table that has two columns from_city to_city now lets assume
I have two tables in my database. TableOne has theKey primary key. TableTwo has
Suppose we have a table Users that has only one column UserId which is
I have two tables that are connected via a Foreign Key. In table A
I have 3 tables, the first one, table1, has as primary key the id
Let's say I have table TabA with columns: col1 - primary key (but not

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.