Database query problems. online and other data table checkworkuseridstartdateenddateremark12011-11-012011-11-03 leave 12011-11-252011-11-26 due to public out 22011-11-11-42011-11-database query problems.
Data table checkwork
Userid startdate enddate remark
1 Leave
1 2011-11-25 2011-11-26 out of office
2 2011-11-04 2011-11-06 holidays
Now I need to find out the number of days for "leave" for a person with a userid of 1 in March and display it. how can this problem be achieved ?? How to write SQL statements ??...
------ Solution --------------------
Select count ('remark') AS 'total' FROM 'checkwork' WHERE 'userid' = 1 group by 'remark ';
------ Solution --------------------
I will give you another intuitive (unregister the SQL section), hoping to help you. This should be a pseudo code.
PHP code
= '$ Startime' "; * $ rs = $ conn-> Execute ($ SQL); * $ remak = $ rs-> Fields ['remak']-> Value; */echo $ startime. "------- remarks ". $ remak."
"; // Read the date and remarks field $ startime = date ('Y-m-D', strtotime ($ startime) + 86400); }}?>