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

  • SEARCH
  • Home
  • 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 9214489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:59:01+00:00 2026-06-18T01:59:01+00:00

I am trying to put together a realtime view of users on our ticketing

  • 0

I am trying to put together a realtime view of users on our ticketing site.

Currently, I have 2 sessions on the site (Session col). My current query returns the following:

EVENTID     EVENT      Session    SessionOpened           SessionLength   NumberofTix
1619        BB King     11         2013-01-28 09:34:16.300   -2            2
1622        BB King     12         2013-01-28 09:36:55.073    0            1
1622        BB King     12         2013-01-28 09:36:55.077    0            3

However, it should look like this :

EVENTID     EVENT      Session    SessionOpened           SessionLength   NumberofTix
1619        BB King     11         2013-01-28 09:34:16.300   -2            2
1622        BB King     12         2013-01-28 09:36:55.073    0            4

Why is Session 12 returning 2 rows- 1 with 1 ticket and 1 with 3 tickets?

The query:

SELECT distinct set_eSRO_Event as EventID, shName as EventName, setSRO_UID as SRO_SessionID, setDateTime as SessionStarted, 
DATEDIFF(mi, getDate(), setDateTime) as SessionTimer, Count(*) AS NumberofTickets FROM SessionTickets
INNER JOIN Shows on shCode = setShowCode
WHERE setStatus = 0
GROUP BY setsro_UID, shName, set_eSRO_Event, setDateTime
  • 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-06-18T01:59:01+00:00Added an answer on June 18, 2026 at 1:59 am

    your result’s columns and query’s aliases are not coherent, so hard to say. I would imagine that setDateTime is different (= SessionStarted or SessionOpened). As you group by setDatetime, if they are different => two lines.

    So add a MIN aggregate function to setDatetime (as in your “wanted” result), and remove setDatetime from GROUP BY

    SELECT set_eSRO_Event as EventID, 
    shName as EventName, 
    setSRO_UID as SRO_SessionID, 
    MIN(setDateTime) as SessionStarted, 
    DATEDIFF(mi, getDate(), MIN(setDateTime)) as SessionTimer, 
    COUNT(*) AS NumberofTickets 
    FROM SessionTickets
    INNER JOIN Shows on shCode = setShowCode
    WHERE setStatus = 0
    GROUP BY setsro_UID, shName, set_eSRO_Event
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to put together a very simple REST-style interface for communicating with our
I have been trying to put together something that allows me to extract points
I am trying to put together a simple container view controller that will allow
I'm trying to put together a rails site that uses a number of models.
I'm just trying to put together a webpage for a client, and I have
I am currently trying to put together a simple Illustrator plugin, and coming from
I'm trying to put together simple Backbone app and Pusher. What I have is
I'm currently trying to put together a rich text editor that includes widgets from
I've been trying to put together a gui in MATLAB and have had great
I'm trying to put together a small web app where users enter in the

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.