Solved

between vs IN

Posted on 2016-08-06
2
49 Views
Last Modified: 2016-08-06
Good afternoon, could give me an example where display is better to use BETWEEN and we should not use IN
0
Comment
Question by:enrique_aeo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 45

Accepted Solution

by:
Kent Olsen earned 500 total points
ID: 41745825
They are actually two different things.

If you all the dates between January 1 and today, use

  BETWEEN '01/01/2016' and '08/06/2016'

If you want just the first of the month in that range, use

  IN ('01/02/2016', '02/01/2016', '03/01/2016', ... , '08/01/2016')


Good Luck!
Kent
0
 

Author Closing Comment

by:enrique_aeo
ID: 41745831
ok
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Creating a View from a CTE 15 47
Search Text in Views 2 28
VM SQL server license. 1 67
Convert DateTime format in SQL query 7 10
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question