Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
Select * from  Coursedetails



Courseid    Coursename    CourseType        Coursedate             Active

   1         REO        Revalidation     2016-08-28 00:00:00.000     A
   2         RM         Deck             2016-08-28 00:00:00.000     A
   3         AFF        Advance          2016-08-28 00:00:00.000     A
   4         TFC        Tanker           2016-08-28 00:00:00.000     A
   5         CTF        Tanker           2016-08-29 00:00:00.000     A
   6         AMOS       Deck             2016-08-29 00:00:00.000     A
   7         MFA        Advance          2016-08-29 00:00:00.000     A
   8         DFC        Tanker           2016-08-29 00:00:00.000     A
   9         ECDIS      Tanker           2016-08-30 00:00:00.000     A
   10        GP         Deck             2016-08-30 00:00:00.000     A
   11        DME        Advance          2016-08-30 00:00:00.000     A
   12        DFC        Tanker           2016-08-30 00:00:00.000     A



When i run the above query Select * from Coursedetails. the above output i get.

I want the output as Course date 28th and 29th date only.

SQL
Select * from  Coursedetails



Courseid    Coursename    CourseType        Coursedate             Active

   1         REO        Revalidation     2016-08-28 00:00:00.000     A
   2         RM         Deck             2016-08-28 00:00:00.000     A
   3         AFF        Advance          2016-08-28 00:00:00.000     A
   4         TFC        Tanker           2016-08-28 00:00:00.000     A
   5         CTF        Tanker           2016-08-29 00:00:00.000     A
   6         AMOS       Deck             2016-08-29 00:00:00.000     A
   7         MFA        Advance          2016-08-29 00:00:00.000     A
   8         DFC        Tanker           2016-08-29 00:00:00.000     A


for getting query what changes i need to be my select statement Query

What I have tried:

I want the output as Course date 28th and 29th date only.
Posted
Updated 28-Aug-16 5:46am
v2

Have a look at the WHERE clause:
SQL WHERE Clause[^]

Looks like you need to learn SQL seriously
SQL Tutorial[^]
 
Share this answer
 
Comments
Maciej Los 28-Aug-16 11:46am    
Good suggestion!
Patrice T 28-Aug-16 11:53am    
I guess the upvote is you, so Thank you.
Maciej Los 28-Aug-16 11:57am    
;)You're very welcome.
Try this:

SQL
SELECT <ListOfColumns>
FROM TableName
WHERE DateField BETWEEN '2016-08-28' AND '2016-08-29'

or
SQL
SELECT <ListOfColumns>
FROM TableName
WHERE DateField IN ('2016-08-28', '2016-08-29')

or
SQL
SELECT <ListOfColumns>
FROM TableName
WHERE DateField >= '2016-08-28' AND DateField <='2016-08-29'
 
Share this answer
 
Comments
Member 13527798 18-Nov-17 0:50am    
Nic
Maciej Los 19-Nov-17 15:50pm    
???

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900