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

The Archive Base Latest Questions

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

I want to pass in @batch date into batch_date…But it shows error…The error is

  • 0

I want to pass in @batch date into batch_date…But it shows error…The error is

Column ‘dbo.tnx_tid_InvCheck_Details.Batch_Date’ is invalid in the
select list because it is not contained in either an aggregate
function or the GROUP BY clause.

The InvCheck_Details table has batch_date for each and every part_no. I want to group the part_no so that I can count(tid) and sum(tid_bal) by part_no. What should i do in order to run this script? TQ…

DECLARE @batch_date datetime
SET @batch_date = '2012-10-13 00:00:00.000'



CREATE TABLE #inv_check
(batch_date datetime,part_no varchar(25),Number_of_tid int,Updated_DT int, Tot_Tid_Bal int)

INSERT INTO #inv_check
SELECT batch_date,part_no,COUNT(tid)as Number_of_tid,0,sum(Tid_Bal)
FROM dbo.tnx_tid_InvCheck_Details
where batch_date = @batch_date
Group by part_no
order by part_no

UPDATE #inv_check 
SET Updated_DT = isnull(d.Updated_DT,0) 
--select i.part_no,i.Number_of_tid, isnull(d.Updated_DT,0)
FROM #inv_check i
LEFT OUTER JOIN 
    (SELECT part_no, COUNT(LastUpdate_DT)as Updated_DT,
    sum(tid_bal) as Tid_bal_sum
    FROM dbo.tnx_tid_InvCheck_Details
    Where NOT LastUpdate_DT IS NULL
    Group by part_no) d on i.part_no=d.part_no  



    DECLARE @sql int
    DECLARE @sql1 int


SELECT @sql1 = count(part_no) 
FROM #inv_check

SELECT @sql = count(part_no)
FROM #inv_check
WHERE number_of_tid= Updated_DT

SELECT @sql AS Parts_Counted,@sql1 AS Full_Parts

Drop table #inv_check
  • 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:49:21+00:00Added an answer on June 13, 2026 at 10:49 pm

    Try this

    INSERT INTO #inv_check
    Select y.batch_date,x.*
    From dbo.tnx_tid_InvCheck_Details y
    Join(
    
        SELECT part_no,COUNT(tid)as Number_of_tid,0 AS Updated_DT,sum(Tid_Bal) As Tot_Tid_Bal
        FROM dbo.tnx_tid_InvCheck_Details
        where batch_date = @batch_date
        Group by part_no
        )x
    On x.part_no = y.part_no
    order by x.part_no
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want pass a value to ssis package, but i have an error back
I want to pass data from second tab to first tab using delegates.But delegate
In my batch file I want to pass multiple parameters to some other application.
I am running a batch file, where I want to pass parameters from Textbox
I want pass an array from Class A to Class B, but A calls
I want pass a class-instace to a method of an other and be sure
My data is just number, I want pass it from VC1 to VC2 for
I want to pass an ImageIcon instance by value as we know that by
I want to pass '#' to the query string like ?page.aspx?someParam=1234#5 .
I want to pass a string that contains few words to jQuery when click

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.