Hi Need help on this query. If I run it up and to the 'REPRES' Section it comes back perfectly. The problem is I need to select between those 2 dates in the "date_entered" column as well.
I getting my data from 2 tables named "fine" and "charge" if selects only the data that has "REDIR" and "REPRES" in the 'status' column but if's not filtering out the to select only between those 2 dates.
Please help.
SELECT fine.case, fine.regnum, fine.issuing_authority, fine.date_entered, charge.amount, fine.status
FROM fine INNER JOIN charge ON fine.case=charge.case
WHERE fine.status = 'REDIR' OR fine.status = 'REPRES'
AND fine.date_entered >= DATE_FORMAT(fine.date_entered, '%d-%m-%Y') = "1/1/2010"
AND fine.date_entered <= DATE_FORMAT(fine.date_entered, '%d-%m-%Y') = "31/12/2010";
This is the result; As you can see the dates has no effect on it.
'1179430141159012', 'ZHD107GP', 'ALBERTON', '9/2/2011', '100', 'REDIR'
'BF80287274110', 'YZD473GP', 'BELFAST', '9/2/2011', '750', 'REDIR'
'1167289141134730', 'VPH261GP', 'ALBERTON', '9/2/2011', '100', 'REDIR'
'0240240055398532', 'YZD461GP', 'JHB', '9/2/2011', '750', 'REDIR'
'0240240054323059', 'ZKW597GP', 'JHB', '9/2/2011', '1500', 'REDIR'
'N80049240120', 'ZWB136GP', 'NELSPRUIT', '9/2/2011', '750', 'REDIR'
'MB80029645105', 'XPT612GP', 'MIDDELBURG', '9/2/2011', '100', 'REDIR'
'0240240057503759', 'XXK353GP', 'JHB', '9/2/2011', '750', 'REDIR'
'0240240054295984', 'YZF152GP', 'JHB', '9/2/2011', '750', 'REDIR'
'0240240054291614', 'SHD923GP', 'JHB', '9/2/2011', '1500', 'REDIR'
'0240240054215571', 'JDG518GP', 'JHB', '9/2/2011', '750', 'REDIR'
'0240240055373045', 'SJV048GP', 'JHB', '9/2/2011', '1500', 'REDIR'
'0240240055326163', 'DDJ186GP', 'JHB', '9/2/2011', '750', 'REDIR'
'0240240055404932', 'SJV048GP', 'JHB', '15/3/2011', '4500', 'REDIR'
Thank you. Any help will be appreciated.
:-)