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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:11:42+00:00 2026-06-10T17:11:42+00:00

Here Im trying to add extra row by using union query between data and

  • 0

Here Im trying to add extra row by using union query between data and result data.

select color, item, sum(qua) from inventory
Group by color, item
UNION
Select '----','----','----'
Union
select Count(color), 'total', sum(qua)
from inventory

Result would be:

ITME    COLOR   QUA
----    -----   ----
chair   Black   520
chair   pink    1028
chair   Red 1050
chair   Yellow  524
table   Black   1048
table   Blue    124
table   pink    624
table   Red 524
table   Yellow  548
-----   -----   -----    <----This extra row.
13  total   5990

I used above query but It show me Data type mismatch error.
Conversion failed when converting the varchar value ‘—-‘ to data type int.
I’m using Microsoft SQL server management studio r2 2008

  • 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-10T17:11:43+00:00Added an answer on June 10, 2026 at 5:11 pm

    Use UNION ALL instead of UNION

    UNION The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the
    UNION command all selected columns need to be of the same data
    type. With UNION, only distinct values are selected.

    UNION ALL The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values.

    Reference

    You should always be using UNION ALL unless you are removing duplicates.

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

Sidebar

Related Questions

I am trying to add an extra item to my WCF service. Here is
Im trying to add a list view to my activity. Here is what is
I am trying to add the following jar file: tika-app-1.1 Here is the Console
I'm trying to add a Search-ActionView to my application (as explained here http://developer.android.com/guide/topics/search/search-dialog.html#UsingSearchWidget ).
I am trying to add an attirubute to objects that i created.Here i created
I'm trying to add a custom catalog index based on the recommendation here: http://collective-docs.readthedocs.org/en/latest/searching_and_indexing/indexing.html#custom-index-methods
I'm trying to add ASPxGridView to page and bind it to ObjectDataSource programmatically. here
I'm trying to add an inline formset to a form. Here's the minimal code
I'm trying to add controller to my Todo list app. Here's the code. $(function(){
I am trying to add Become-a-Fan button to my 2008 asp.net website (vb) Here

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.