CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 1999
    Posts
    191

    SQL question - thanks

    I don't know what is wrong in the following

    ------------

    SELECT @SQL2 = "INSERT INTO #ACETmp " +
    "SELECT rptSection = 'A',
    Field1 = SummValue,
    Field2 = sum(ItemAmount) " +
    " FROM vRptbase2
    where trantype in ( '33','35') group by SummValue"
    execute (SQL2)
    --------------------

    something wrong with "sum(ItemAmount)". I don't know how to place it correctly. It is how to put "sum(ItemAmount)" within double "".

    Please help me out. thanks



  2. #2
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: SQL question - thanks

    Not sure if this is the problem but when you use a Calculation function in SQL you have to give it a field name. For example...

    SELECT SUM(FieldtoSum) as MySum FROM myTable;

    Hope this helps


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured