Demo of getting records between two dates

We will use our student table and link this table to fee payment table to test various quires to collect records between two date ranges. Here are our two tables with some sample data.
fee_ididdtamount
112013-01-08200
212013-01-10100
322013-01-24120
432013-02-12211
522013-02-07150
632013-02-06135
742013-02-14100
idnameclassmark
1John DeoFour75
2Max RuinThree85
3ArnoldThree55
4Krish StarFour60
5John MikeFour60
6Alex JohnFour55
Here is our query to display records between two date ranges
SELECT * FROM `student_fee` WHERE dt BETWEEN '2013-01-09' and '2013-01-30'
We will get output displaying two records
fee_ididdtamount
212013-01-10100
322013-01-24120
Now Linking two tables we will display the records
SELECT * FROM `student_fee`,student WHERE student_fee.id=student.id and  dt BETWEEN '2013-01-09' and '2013-01-30'
The output is here
fee_ididdtamountidnameclassmark
212013-01-101001John DeoFour75
322013-01-241202Max RuinThree85
Try to find out total fee collected in Jan 2013
Try to find out how much John Deo had paid in Feb 2013

Download sql dump of student table
Download sql dump of studnet_fee table

plus2net.com



saraazee

03-06-2014

how can we retrieve the data from database by a particular month?

Post your comments , suggestion , error , requirements etc here .










We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer