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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:58:23+00:00 2026-05-26T17:58:23+00:00

So I have a table which is structured in the following format: in_click first_name

  • 0

So I have a table which is structured in the following format:

in_click  first_name      create_date 
100       joe             2011-10-01 10:01
100       joe             2011-10-01 10:05
100       joe             2011-10-01 10:07
100       joe             2011-10-01 10:08
100       joe             2011-10-01 10:10
101       sara            2011-10-01 10:15
101       sara            2011-10-01 10:17
101       sara            2011-10-01 10:20
101       sara            2011-10-01 10:22

For each first name, I want to select the first and last rows.
So it should be the first date with the name joe and the last date
where the first name is joe. Kinda like an if-else statement, but
I’m just not sure how to get that information in MySQL.

Help?!

I’m running the following query to just get everything:

SELECT t.in_click_id, t.keyword, c.lead_id, c.first_name, c.last_name, 
ls.create_date, ls.discriminator, l.affiliate_id 
FROM lead_status AS ls
INNER JOIN leads AS l ON l.id = ls.lead_id 
INNER JOIN tracker AS t ON l.in_click_id = t.in_click_id
INNER JOIN contacts AS c ON ls.lead_id = c.lead_id 
WHERE l.affiliate_id NOT IN('1002','1003')
AND ls.create_date BETWEEN '2011-11-09' AND '2011-11-10';

This is what I’m trying to get:

in_click  first_name      create_date 
100       joe             2011-10-01 10:01
100       joe             2011-10-01 10:10
101       sara            2011-10-01 10:15
101       sara            2011-10-01 10:22
  • 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-26T17:58:24+00:00Added an answer on May 26, 2026 at 5:58 pm

    This works with the data you provided, can’t say it would work in MySQL, but it works in SQL Server.

    select t.in_click, 
        t.first_name,
        t.create_date
    from tracker t
    where 
        t.create_date = (select min(create_date) from tracker where in_click = t.in_click)
        or t.create_date = (select max(create_date) from tracker where in_click = t.in_click)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a table of transactions which is structured like the following : TranxID
I have the following html structure (which is generated and I can't change): <table
I have the following table structure, which is imported into an Entity Framework project:
I have a table in database which has following structure(data) : +--------------------------+ Organization +--------------------------+
I have a table which have the following structure, the columns are origin, destination,
I have a table which contains records which are related in the following way:
I have the following table structure which has been imported into the Entity Framework.
I have a CSV file in following format which I wish to import in
I have a table reply of which structure is following: Id name parent_id ...
I have a table discussion of which structure is following: Table name: discussion, Id

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.