Database query problems

Source: Internet
Author: User
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); }}?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.