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

  • Home
  • SEARCH
  • 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 8739905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:02:18+00:00 2026-06-13T11:02:18+00:00

I have a table with 4 records: NAME INSTRUMENT BOOLEAN 1 BOOLEAN 2 Bob

  • 0

I have a table with 4 records:

NAME    INSTRUMENT    BOOLEAN 1  BOOLEAN 2
Bob     Organ         TRUE       FALSE
Thomas  Violin        FALSE      FALSE
Bob     Piano         FALSE      TRUE

I want to merge records with same “NAME”, in order to get :

Bob     Organ Piano   TRUE       TRUE
Thomas  Violin        FALSE      FALSE

What’s the rule that I want when merging ?

  • “text fields” are just concatenated (example : Organ + Piano ==> “Organ Piano”)

  • “boolean fields” are merged with a LOGICAL OR (example : TRUE or FALSE = TRUE)

My questions :

1) I will choose which software to use in regard to the ability to do this! Database with SQL queries (SQLite, MySQL or even Access) or Excel ?

2) If the best solution is a database, what’s the SQL query to do that ?

Thanks a lot in advance!

  • 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-13T11:02:19+00:00Added an answer on June 13, 2026 at 11:02 am

    My choes and SQLServer2005+

    SELECT a.NAME AS NAME,(
    SELECT ISNULL(b.INSTRUMENT, '')+ ' '
    FROM dbo.COExample b WHERE b.NAME=a.NAME
    FOR XML PATH('')) AS INSTRUMENT, MAX(CAST(BOOLEAN1 AS int)) AS BOOLEAN1, MAX(CAST(BOOLEAN2 AS int)) AS BOOLEAN2
    FROM dbo.COExample a
    GROUP BY a.NAME
    

    Example on SQLFiddle

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

Sidebar

Related Questions

I have table with following structure and records. table t1 +------+-------------+---------------------+ | name |
Say we have 3 records in table: orig_tab --------------------------------------------- | PK | Name |
I have table a joining table b, I only want the records from table
I have a table that stores records like this: name | stat | value
I have table Cars Id nvarchar(25) PK Name nvarchar(max) And there is some records.
I have a table with Column name Height, the table has millions of records
Hi I will Explain what i want... I have a table with records like
Hello I have table name FriendsData that contains duplicate records as shown below fID
In SQL Server 2008, I have table with records like these, Name ---- John
I have a table with records that have 8 integer values: TableChild: Parent 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.