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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:38:02+00:00 2026-05-15T03:38:02+00:00

i have a problem with selecting some values from my DB. DB is in

  • 0

i have a problem with selecting some values from my DB. DB is in design stages so i can redesign it a bit of needed.

You can see the Diagram on this image

Basically what i want to select is

select 
c.campaignID,
ct.campaignTypeName,
c.campaignName,
c.campaignDailyBudget,
c.campaignTotalBudget,
c.campaignCPC,
c.date,
cs.campaignStatusName
***impressions,
***clicks,
***cast(campaignTotalBudget-(clicks*campaignCPC) as decimal(18,1)) as remainingFunds 
from Campaigns as c
left join CampaignTypes as ct on c.campaignTypeID=ct.campaignTypeID
left join CampaignStatuses as cs on c.campaignStatusID=cs.campaignStatusID
left join CampaignVariants as cv on c.campaignID=cv.campaignID
left join CampaignVariants2Visitors as c2v on cv.campaignVariantID=c2v.campaignVariantID
left join Visitors as v on c2v.visitorID=v.visitorID
.....
order by c.campaignID desc

Problem is that Visitors table has column named isClick so i don’t know the way to separate what is impression with isClick=false and what is click isClick=true so i can show nice form with all the stuff about campaign and visitors…

I don’t think to split Visitors to two tables like Impressions and Click is a good idea because again i would need to have Visitors with two more tables

thanks

  • 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-05-15T03:38:03+00:00Added an answer on May 15, 2026 at 3:38 am

    It is not clear what “impressions” are in your diagram. However, if you are wondering how to count clicks per campaign, you can do something like:

    Select ...
    From Campaigns As c
        ...
        Left Join (
                    Select V1.VisitorId
                        , CV2V1.CompaignVariantID
                        , Sum( Case When V1.IsClick = 1 Then 1 Else 0 End ) As ClickCount
                        , Count(*) TotalVisitorCount
                    From Visitors As V1
                        Join CompaignVariant2Visitors As CV2V1
                            On CV2V1.VisitorId = V1.VisitorID
                    Group By V1.VisitorId, CV2V1.CompaignVariantID
                    ) As VisitTotals
            On VisitTotals.VisitorId= C2V.VisitorId
                And VisitTotals.CampaignVariantID = C2V.CampaignVariantID
    ...
    Order By c.campaignID desc  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 402k
  • Answers 402k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Figured it out. needed to change The Given I am… May 15, 2026 at 4:54 am
  • Editorial Team
    Editorial Team added an answer Because that's the natural behavior of every browser. You need… May 15, 2026 at 4:54 am
  • Editorial Team
    Editorial Team added an answer Do you want to show/hide submenu by click on item… May 15, 2026 at 4:53 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.