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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:34:25+00:00 2026-06-10T14:34:25+00:00

I have some tables: Sessions SessionID int PK Created datetime SiteId int FK Tracking_Parameters

  • 0

I have some tables:

Sessions
SessionID int PK
Created datetime
SiteId int FK

Tracking_Parameters
ParamID int PK
ParamName nvarchar

Session_Custom_Tracking
SessionID int FK
ParamID int FK
ParamValue nvarchar

Site_Custom_Parameters
SiteID int FK
ParamID int FK
ParamKey nvarchar

Sessions: Contains the unique session id for a visitor and the time they entered the site.

Tracking_Parameters: Contains a list of things that you may want to track on a site (i.e. Email Open, Email Click, Article Viewed, etc.)

Site_Custom_Parameters: For a particular site (table not shown), declares the key value for a Tracking_Parameter (i.e. the key to look for in a query string or route)

Session_Custom_Tracking: The link between a session and a tracking parameter and also contains the value for the parameter’s key when it was found by my application.

Question:

I want to select session id’s where for these particular sessions, there is a record in the Session_Custom_Tracking for two different ParamID’s. I want to find sessions where a user both opened an email (paramid 1) and clicked (paramid 3) a link in that email.

  • 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-10T14:34:26+00:00Added an answer on June 10, 2026 at 2:34 pm

    You can join to the same table twice:

    SELECT S.SessionID
    FROM Sessions AS S
    JOIN Session_Custom_Tracking AS SCT1
    ON SCT1.SessionID = S.SessionID
    AND SCT1.ParamID = 1
    JOIN Session_Custom_Tracking AS SCT2
    ON SCT2.SessionID = S.SessionID
    AND SCT2.ParamID = 3
    

    An alteranative that might be easier to read (because it more closely matches the way you describe the problem) is to use WHERE EXISTS:

    SELECT S.SessionID
    FROM Sessions AS S
    WHERE EXISTS
    (
        SELECT *
        FROM Session_Custom_Tracking AS SCT1
        WHERE SCT1.SessionID = S.SessionID
        AND SCT1.ParamID = 1
    )
    AND EXISTS
    (
        SELECT *
        FROM Session_Custom_Tracking AS SCT2
        WHERE SCT2.SessionID = S.SessionID
        AND SCT2.ParamID = 3
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some tables roughly like so: Client: id name Employee id name Email
I have some tables that I'm joining in a query with Postgres (9). However,
I have some tables with data: Category CategoryID CategoryName 1 Home 2 Contact 3
I have some tables that benefit from many-to-many tables. For example the team table.
I have some tables. These tables all have one column in common called 'classified_id':
I have some tables: Employee: id, name, id_suc, id dep, id_sec Suc : id_suc,
I have some tables for which I have no reason to ever update from
I have some transliteration tables in code that are formated to make it easier
I am using Sql database and I have indexed some tables. In some tables
Greetings, I have some mysql tables that are currently using an md5 hash as

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.