문제

I have an array of all months in strings ie ['January', 'February',...etc]. I want to loop over this array and pass it to a SQL command that will get everything within that month. For example

SELECT * WHERE foodate='January'

will return all records from January 1st to January 31st.

도움이 되었습니까?

해결책

Have you tried this?

select *from your_table where monthname(foodate)='January' ;

다른 팁

Is that foodate is varchar or date type?

If it's varchar you can do something like :

SELECT * WHERE foodate LIKE '%January%'

Or you can see here some response for date type

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top