Click here to Skip to main content
15,905,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all, having a problem searching by date ranges I got 2 textboxes "StartDate" and "EndDate" both have the jquery datepicker assigned to them im retrieving information from a MySQL database but now i want to retrieve information from the "StartDate" to the "EndDate" only, would like to use a button control "Show date range info", my MySQL query at the moment is

SQL
SELECT transactions.transaction_id, transactions.date_time, transaction_type.transaction_type_description, transactions.amount FROM `transactions`" +
"INNER JOIN transaction_type ON transaction_type.transaction_type_id = transactions.transaction_type_id " +
"WHERE account_or_member_id = '53' and is_member = '1' " +
"Order by transactions.date_time ASC",con2


any help please
Wes
Posted
Updated 3-Oct-12 0:48am
v3

1 solution

Try:
SQL
SELECT * FROM myTable WHERE myDateColumn BETWEEN '2011-01-01' AND '2012-06-31'
 
Share this answer
 
Comments
Wes101 3-Oct-12 6:55am    
will that work with the 2 textboxes? cause i want to get that dates from the 2 textboxes to search from
OriginalGriff 3-Oct-12 7:09am    
Yes - just replace the two dates in the example with parameters, and pass the values through as DateTime objects to avoid SQL Injection attacks.

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