Professional Web Applications Themes

How to derive summary info from one single table.. - Microsoft SQL / MS SQL Server

Something along the lines of ... SLECT col1, sum(col3), sum(col4) FROM tbl WHERE col2 BETWEEN d1 AND d2 GROUP BY col1 ; -- - Anith ( Please reply to newsgroups only )...

  1. #1

    Default Re: How to derive summary info from one single table..

    Something along the lines of ...

    SLECT col1, sum(col3), sum(col4)
    FROM tbl
    WHERE col2 BETWEEN d1 AND d2
    GROUP BY col1 ;

    --
    - Anith
    ( Please reply to newsgroups only )


    Anith Sen Guest

  2. #2

    Default Re: How to derive summary info from one single table..

    something like this should do...
    select UserName, sum(Received_Count) as Received, sum(Sent_Count) as Sent
    from tbname
    where Date between '20030701' and '20030702'
    group by UserName

    --
    -oj
    RAC v2.2 & QALite!
    [url]http://www.rac4sql.net[/url]


    "dtong101" <dtong101hotmail.com> wrote in message
    news:0d6d01c344ce$ed943250$a001280aphx.gbl...
    > Hi, Any feedbacks are appreciated.
    >
    > I have to produce a summary report from one table. The
    > fields are UserName, Date, Received_Count, Sent_Count.
    > The record is unique when UserName and Date are
    > concatenated.
    >
    > I need to produce a summary report that list each UserName
    > with summarized Received_Count and Sent_Count with a range
    > of Date.
    >
    > Sample records:
    > Joe 2003-01-07 192 30
    > Joe 2003-02-07 121 45
    > Mary 2003-01-07 100 10
    > Mary 2003-02-07 200 99
    >
    > For the date range of 2003-01-07 to 2003-02-07
    > Joe 313 75
    > Mary 300 99
    >
    > Thanks.
    > DT

    oj Guest

  3. #3

    Default How to derive summary info from one single table..

    Thx. Both work....
    >-----Original Message-----
    >Hi, Any feedbacks are appreciated.
    >
    >I have to produce a summary report from one table. The
    >fields are UserName, Date, Received_Count, Sent_Count.
    >The record is unique when UserName and Date are
    >concatenated.
    >
    >I need to produce a summary report that list each
    UserName
    >with summarized Received_Count and Sent_Count with a
    range
    >of Date.
    >
    >Sample records:
    >Joe 2003-01-07 192 30
    >Joe 2003-02-07 121 45
    >Mary 2003-01-07 100 10
    >Mary 2003-02-07 200 99
    >
    >For the date range of 2003-01-07 to 2003-02-07
    >Joe 313 75
    >Mary 300 99
    >
    >Thanks.
    >DT
    >.
    >
    dtong101 Guest

Similar Threads

  1. Replies: 0
    Last Post: September 16th, 04:37 PM
  2. Replies: 0
    Last Post: September 15th, 05:39 AM
  3. Replies: 0
    Last Post: September 10th, 05:33 PM
  4. Replies: 0
    Last Post: September 10th, 05:29 PM
  5. Summary fields or Summary table?
    By Scott in forum FileMaker
    Replies: 1
    Last Post: June 27th, 03:34 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139