Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. total Impression for same id and name

total Impression for same id and name

Scheduled Pinned Locked Moved Database
databasesql-serversysadmin
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    r aa j
    wrote on last edited by
    #1

    hi here I am using SQL SErver 2005 with following query..... select distinct dbo.AE_Site.siteId as siteId,dbo.AE_Site.siteName as siteName,dbo.AE_Dimension.Impression as Impression from AE_Dimension inner join AE_Channel on dbo.AE_Dimension.channelId=dbo.AE_Channel.channelId inner join AE_Site on dbo.AE_Channel.siteId=dbo.AE_Site.siteId where dbo.AE_Dimension.cpm='0.5$' output is siteId siteName Impression 301 msn india 10 301 msn india 15 336 Yahoo India 45645 but I want output like siteId siteName Impression 301 msn india 25 336 Yahoo India 45645 anybody plz reply me ASAP.... Thanks

    Rajendran.AL

    B A R 3 Replies Last reply
    0
    • R r aa j

      hi here I am using SQL SErver 2005 with following query..... select distinct dbo.AE_Site.siteId as siteId,dbo.AE_Site.siteName as siteName,dbo.AE_Dimension.Impression as Impression from AE_Dimension inner join AE_Channel on dbo.AE_Dimension.channelId=dbo.AE_Channel.channelId inner join AE_Site on dbo.AE_Channel.siteId=dbo.AE_Site.siteId where dbo.AE_Dimension.cpm='0.5$' output is siteId siteName Impression 301 msn india 10 301 msn india 15 336 Yahoo India 45645 but I want output like siteId siteName Impression 301 msn india 25 336 Yahoo India 45645 anybody plz reply me ASAP.... Thanks

      Rajendran.AL

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      select distinct dbo.AE_Site.siteId as siteId,dbo.AE_Site.siteName as siteName,(select sum(dbo.AE_Dimension.Impression) from dbo.AE_Dimension where dbo.AE_Dimension.chanelID in (select dbo.AE_Channel.channelId from AE_Channel)) where dbo.AE_Channel.siteId in (select dbo.AE_Channel.siteID from AE_Channel) and dbo.AE_Dimension.cpm='0.5$' hope it helps to you...


      I Love T-SQL

      1 Reply Last reply
      0
      • R r aa j

        hi here I am using SQL SErver 2005 with following query..... select distinct dbo.AE_Site.siteId as siteId,dbo.AE_Site.siteName as siteName,dbo.AE_Dimension.Impression as Impression from AE_Dimension inner join AE_Channel on dbo.AE_Dimension.channelId=dbo.AE_Channel.channelId inner join AE_Site on dbo.AE_Channel.siteId=dbo.AE_Site.siteId where dbo.AE_Dimension.cpm='0.5$' output is siteId siteName Impression 301 msn india 10 301 msn india 15 336 Yahoo India 45645 but I want output like siteId siteName Impression 301 msn india 25 336 Yahoo India 45645 anybody plz reply me ASAP.... Thanks

        Rajendran.AL

        A Offline
        A Offline
        andyharman
        wrote on last edited by
        #3

        Try:

        select S.siteId, S.siteName, sum(D.Impression) as Impression
          from dbo.AE_Dimension as D
          inner join dbo.AE_Channel as C
            on D.channelId = C.channelId 
          inner join dbo.AE_Site as S
            on C.siteId = S.siteId
          where D.cpm = '0.5$'
          group by S.siteId, S.siteName
        

        Note that using table-aliases (e.g. "D" instead of "dbo.AE_Dimension") makes it more readable.

        1 Reply Last reply
        0
        • R r aa j

          hi here I am using SQL SErver 2005 with following query..... select distinct dbo.AE_Site.siteId as siteId,dbo.AE_Site.siteName as siteName,dbo.AE_Dimension.Impression as Impression from AE_Dimension inner join AE_Channel on dbo.AE_Dimension.channelId=dbo.AE_Channel.channelId inner join AE_Site on dbo.AE_Channel.siteId=dbo.AE_Site.siteId where dbo.AE_Dimension.cpm='0.5$' output is siteId siteName Impression 301 msn india 10 301 msn india 15 336 Yahoo India 45645 but I want output like siteId siteName Impression 301 msn india 25 336 Yahoo India 45645 anybody plz reply me ASAP.... Thanks

          Rajendran.AL

          R Offline
          R Offline
          Rajkamal_dfine
          wrote on last edited by
          #4

          Use group by siteId ...

          N.Rajakumar B.E.,

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups