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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:29:48+00:00 2026-05-31T07:29:48+00:00

How to write such select: SELECT filename, username, date_time, field1, field2… FROM… JOIN… WHERE…

  • 0

How to write such select:

SELECT filename, username, date_time, field1, field2... FROM... JOIN... WHERE...
UNLESS user_downloaded_this_file_today_already

I would like to ignore files downloaded by the same user on the same day. Data example:

12 | file1.jpg | barney | 2012-03-15 12:50:10 | ...
13 | file1.jpg | roger  | 2012-03-15 13:50:10 | ...
14 | file2.jpg | barney | 2012-03-15 14:50:10 | ...
15 | file1.jpg | barney | 2012-03-15 15:50:10 | ...

How do I write a SELECT that would ignore 4th line? Same filename, same user, day difference < 1. Is this actually possible?

  • 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-31T07:29:50+00:00Added an answer on May 31, 2026 at 7:29 am

    Simply use SELECT DISTINCT (assuming you don’t need the numeric column since it’s not in your select):

    SELECT DISTINCT  FileName,
                     UserName,
                     Date_Time
    FROM             [YourTable]
    

    If your Date_Time column contains times and not just 00:00:00, you’ll need to strip out the time for DISTINCT to work properly:

    SELECT DISTINCT  FileName,
                     UserName,
                     CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, Date_Time))) AS Date_Time
    FROM             [YourTable]
    

    Here’s an example of the date stripping in action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In SQL, you could write a query such as: SELECT NAME, QUOTA, SALES FROM
select * FROM contacts WHERE address like ? or ? like address or ?
I have Users->Orders tables (one to many) and would like to select all users
I have a table like follows: mysql> select * from tries; +----+--------+-----------+ | id
I would like to return multiple values in my case statement, such as :
I have two datetime columns in a table, and I would like to select
Does anyone have any advice how to write such app? Or maybe knows some
I see in MSDN links such as CompareOrdinal Overloads. How can I write such
Today, I found out that you can write such code in C++ and compile
How can I write this in such a way that $counter value is 1

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.