Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Team,

Following is the table:

ECNO	BRANCH	MONTH	ISDELETED
1	B1	February 2018	n
2	B3	February 2018	n
3	B3	March 2018	n
4	B1	March 2018	n
5	B2	January 2018	n
6	B3	January 2018	n


Here we need to select according to branch and starting date and end date.

Case1:
If branch is B3, starting date and end date is equal then
pick according the branch selected.

select * from HR_BULKBILL_DETAILS where BRANCH='B3' AND MONTH='March 2018'


This query works fine

Case 2:
If Staring date (Assume January 2018) and End date (Assume Febuary 2018) And Branch b3. How to check this condition in select query

How Check two condition for one field?

Note: (In database we have only column Month:this hold month- year example : Januray 2018)
I am using my sql.

What I have tried:

select * from HR_BULKBILL_DETAILS where  MONTH='February 2018' AND MONTH='March 2018' AND BRANCH='B3'
Posted
Updated 20-Feb-18 19:08pm
v2
Comments
Sissy Ram 21-Feb-18 0:57am    
Forgive me if any typo.
My Expected Output is:
ECNO BRANCH MONTH ISDELETED 2 B3 February 2018 n 3 B3 March 2018 n
My Input is user give startedate and end date and brach
Startdate and enddate will be like March 2018

1 solution

Finally I got result by using "between"
Following is the query:
select * from HR_BULKBILL_DETAILS where MONTH Between 'February 2018' AND 'March 2018' and BRANCH='B3'
 
Share this answer
 

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