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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:46:47+00:00 2026-05-11T08:46:47+00:00

alt text http://agricam.net/test.gif I need to add a row dynamically in SQL after the

  • 0

alt text http://agricam.net/test.gif

I need to add a row dynamically in SQL after the Marketer number changes with the header ‘Marketer Total’ that should add only the ‘Total’ column. For example, after the last row of Marketer 22 row, there should be ‘Marketer Total’ and then under the Total column should be 1804. The same should occur after the last row of Marketer 500.

See image at http://agricam.net/test.gif

Current Query:

select Marketer, SubMarketer, Grade, Total, Convert(varchar,Date,101)[Date] from SomeTable where Date >= ‘2/25/2009’ and Date < ‘2/26/2009′ and Marketer in (’22’,’500′) group by SubMarketer,Grade,Marketer, Date , total order by Marketer

Thanks.

  • 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. 2026-05-11T08:46:48+00:00Added an answer on May 11, 2026 at 8:46 am

    see Using ROLLUP to aggregate data in SQL

    implementation:

    DECLARE @SOMETABLE TABLE (SUBMARKETER INT, GRADE CHAR, MARKETER INT,    DATE DATETIME, TOTAL INT) INSERT INTO @SOMETABLE SELECT 1415, 'A', 22, '02/25/2009', 26 UNION SELECT 1415, 'B', 22, '02/25/2009', 93 UNION SELECT 1415, 'C', 22, '02/25/2009', 1175 UNION SELECT 1415, 'D', 22, '02/25/2009', 510 UNION SELECT 1169, 'B', 500, '02/25/2009', 1 UNION SELECT 1169, 'C', 500, '02/25/2009', 3 UNION SELECT 1393, 'C', 500, '02/25/2009', 2 UNION SELECT 2, 'B', 500, '02/25/2009', 5 UNION SELECT 2, 'C', 500, '02/25/2009', 111 UNION SELECT 2, 'D', 500, '02/25/2009', 18   SELECT    CASE WHEN SUBMARKETER IS NULL THEN 'Marketer Total'      ELSE CONVERT(VARCHAR, MARKETER) END MARKETER,      SUBMARKETER, GRADE, TOTAL, DATE    FROM (     SELECT MARKETER, SUBMARKETER, GRADE, SUM(TOTAL) AS TOTAL,      CONVERT(VARCHAR,DATE,101)[DATE]      FROM @SOMETABLE      WHERE DATE >= '2/25/2009' AND DATE < '2/26/2009'       AND MARKETER IN ('22','500')      GROUP BY MARKETER, SUBMARKETER, GRADE, DATE WITH ROLLUP )M  WHERE M.MARKETER IS NOT NULL  AND NOT (SUBMARKETER IS NOT NULL AND DATE IS NULL) 

    attention: this will work fine if MARKETER, SUBMARKETER and DATE columns are NOT NULL. If there will be NULL values of theese fields in table, that will became an issue to filter out useless grouping.

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

Sidebar

Related Questions

Look at this image: alt text http://img139.imageshack.us/img139/4488/picture2ep3.png I know how to add UITableView with
I have a products table... alt text http://img357.imageshack.us/img357/6393/productscx5.gif and a revisions table, which is
alt text http://img187.imageshack.us/img187/8453/testhc3.png alt text http://img145.imageshack.us/img145/3306/test2bn4.png The first picture is my query. I need
alt text http://img81.imageshack.us/img81/3130/editorimage.jpg Is there any editor control in asp.net like the one above?
alt text http://img21.imageshack.us/img21/3262/snapshotosz.png I want to add a new tab or site in sharepoint
alt text http://www.freeimagehosting.net/uploads/a96118564f.png In above image, You can see the numbers on the pin.
alt text http://barbarosalp.com/questions/list.png Hi, As you can see on the picture above i have
The picture below explains all: alt text http://img133.imageshack.us/img133/4206/accentar9.png The variable textInput comes from File.ReadAllText(path);
i've got this tables in my database. alt text http://img166.imageshack.us/img166/3133/testdbschemafy5.png With Entity Framework i
alt text http://home.elka.pw.edu.pl/~pkolodzi/Capture.PNG I have created the IAdder interface with two methods: PassA and

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.