Forum Replies Created

Viewing 15 posts - 31 through 45 (of 46 total)

  • RE: PIVOT QUERY HELP NEEDED

    Thanks, I have that for the rows. What I wanted to know was how to add up the columns and have the total below them.

  • RE: PIVOT QUERY HELP NEEDED

    Bob,

    You had said a totals row at end is much quicker and easier. How can I add this last row ? Summing up all the columns ?

  • RE: Automatic Table Insert

    Hello,

    What am trying to do is copy data from table A to another table B, all new data from the table A should be copied to table B,...

  • RE: Automatic Table Insert

    Thanks,

    I have created a stored procedure and scheduled it on a job running every 3 minutes. problem is it keeps overwriting data over and over so I tweaked the query...

  • RE: PIVOT QUERY HELP NEEDED

    It's ok guys. I sorted it out. I had added the cost total as part of the distinct query. This brought about the error.

    This is what it should look like.

    FROM...

  • RE: PIVOT QUERY HELP NEEDED

    Thanks Tom for your help,

    After running the query I realised there is something amiss.

    Going back to the earlier structure

    NAME ID 1/2 2/2 ...

  • RE: PIVOT QUERY HELP NEEDED

    Ok guys, am not a SQL maestro, but I need to know it.

    The parameters we were using were hardcoded. They need to be input by the user. I guess this...

  • RE: PIVOT QUERY HELP NEEDED

    Woohooo ! It worked, it worked ! I wasn't really far from the solution.

    I need to understand more about queries If am to move from the simple SELECT statements...

  • RE: PIVOT QUERY HELP NEEDED

    Am getting this error here : -

    WITH ParamQry AS ( SELECT TRANSDATE,COSTTOTAL, U_Casual_N,SUBJOBID FROM dbo.ENPRISE_JOBCOST_JOBLINESVIEW WHERE SUBJOBID = 1007001 AND TRANSDATE BETWEEN '2009-04-08' AND...

  • RE: PIVOT QUERY HELP NEEDED

    Using Tom's query :-

    I have tried adding the total's column here

    'SELECT U_Casual_N, SUBJOBID, ' + @DATELIST +

    ' Total FROM ParamQry ' +

    But it overwrites on the last...

  • RE: PIVOT QUERY HELP NEEDED

    Do you mean the totals at the last row ? I need them at the end of every person. As this query is supposed to produce a list of people,...

  • RE: PIVOT QUERY HELP NEEDED

    I have now tried both queries. They work wonderfully. The totals line at the end of the report is also a bit important.

    How will the T-SQL relate to the main...

  • RE: PIVOT QUERY HELP NEEDED

    Thanks Tom,

    That was quick. I managed to get the answer, here is what I did

    I changed the MIN to sum.

    select @dynSQL = @dynSQL+',sum(case when TRANSDATE = '...

  • RE: PIVOT QUERY HELP NEEDED

    Thanks Bob,

    However when I two dates with the same entries e.g.

    NAME ID AMT DATE ...

  • RE: PIVOT QUERY HELP NEEDED

    Thanks Tom,

    It quite a complex query you've got there, and I was hoping you would explain it. I would like to add subjobid and a date range as parameters....

Viewing 15 posts - 31 through 45 (of 46 total)