Jump to content

Date Selection


draconlock

Recommended Posts

Hi Everyone, 

 

I have a problem.  So here is my setup.

 

TABLE1

id | firstname

------------------------

1 | John

2 | Susan

3 | Michael

 

TABLE2

userid | date | payment

-------------------------------

1 | 2009-12-28 | Unpaid

2 | 2010-02-10 | Paid

3 | 2010-02-28 | Unpaid

 

This is my select statement

select table1.id, table1.firstname, table2.userid, table2.date, table2.payment from table1 inner join table2 on table2.userid=table1.id where payment='Unpaid' order by table1.id

 

My problem is I want to only select/print the row, where the date is past due and unpaid.

 

Can someone help me figure this out, I can't get it to work and i'm new at this.

 

Thanks

Link to comment
Share on other sites

wat is the date for, in 2nd table?

payment due date?

select table1.id, table1.firstname, table2.userid, table2.date, table2.payment from table1 inner join table2 on table2.userid=table1.id where payment='Unpaid' and unix_timestamp(table2.date)>now() order by table1.id

 

now() might not be the correct function, so u need to figure out

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.