Solved

between vs IN

Posted on 2016-08-06
2
25 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
2 Comments
 
LVL 45

Accepted Solution

by:
Kdo 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Server Log File Space 6 33
C# SQL BULK INSERT CLASS 5 34
SQL server 2008 SP4 29 33
SQL Split character from numbers 3 16
I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now