Jump to content

Group records by paydate


Recommended Posts

Hi Barand,

I hope you don't mind posting my requests in the same thread:

I need help  with mysql query to fetch records in from a single database table grouped by paydate. The structure of table is as follows:

id    int(11) - P,U,AI
sid    int(10) - Student ID from another table
shift    int(1) - values: 1 or 2
name    varchar(50)
vno    int(10) - voucher No. typically a 6 digit number
class    varchar(20)
mfee    varchar(6)     - Monthly fee
month    date
issuedate    date
lastdate    date
paydate    date

Each row in the table keeps the record of fee paid by a student for one month and every students has multiple rows.

What I want to achieve is to fetch records of single month grouped by paydate, example:

PayDate: 2020-04-01 & Month: 2020-04-01:
Name1 | Class1 | Shift1 | VNo 420112
Name2 | Class1 | Shift2 | VNo 42080
Name3 | Class3 | Shift2 | VNo 42063
PayDate: 2020-04-02 & Month: 2020-04-01:
Name4 | Class1 | Shift1 | VNo 42066
Name5 | Class1 | Shift2 | VNo 42034
Name6 | Class3 | Shift2 | VNo 42099

Edited by JDevOnline
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.