Results 1 to 5 of 5

Thread: sql function for weekly and monthly report

  1. #1
    Join Date
    May 2009
    Location
    selangor
    Posts
    4
    Rep Power
    0

    Unhappy sql function for weekly and monthly report

    tumpang tanye pd yg pakar... saya newbie kt sini.. nk tanye pendapat dan pandangan.. kalau kite nk retrive data dr database by monthly umtuk tahun tu adakah sql statement ye kena nyatakan tahun dan bulan nye skali.. da mencube tp masih tak dpt jalan penyelesaian..

    saye try sattement ni..
    HTML Code:
    select e_id, birth_date
    from employee_per where
    MONTH(birth_date) = MONTH(SYSDATE())
    tp result yg keluar untuk stp tahun tp untuk bulan itu shj.
    mintak tolong pada yg tahu...

  2. #2
    Join Date
    Mar 2008
    Location
    pd
    Posts
    497
    Rep Power
    150
    Your SQL looks okay - what is wrong with it?

  3. #3
    Join Date
    Sep 2005
    Location
    in my body lar...
    Posts
    1,325
    Rep Power
    0
    Quote Originally Posted by apiz09 View Post
    tumpang tanye pd yg pakar... saya newbie kt sini.. nk tanye pendapat dan pandangan.. kalau kite nk retrive data dr database by monthly umtuk tahun tu adakah sql statement ye kena nyatakan tahun dan bulan nye skali.. da mencube tp masih tak dpt jalan penyelesaian..

    saye try sattement ni..
    HTML Code:
    select e_id, birth_date
    from employee_per where
    MONTH(birth_date) = MONTH(SYSDATE())
    tp result yg keluar untuk stp tahun tp untuk bulan itu shj.
    mintak tolong pada yg tahu...
    i tak paham apa you nak... wat u want to query out lar???

    izzit by specific month only. Eg: August regardless of year

    or

    by specific month and year. Eg August 2000

    so which one you wanted??? minta tolong jelaskan apa yang u nak...

  4. #4
    Join Date
    May 2009
    Location
    selangor
    Posts
    4
    Rep Power
    0
    Quote Originally Posted by iamfreelancer View Post
    i tak paham apa you nak... wat u want to query out lar???

    izzit by specific month only. Eg: August regardless of year

    or

    by specific month and year. Eg August 2000

    so which one you wanted??? minta tolong jelaskan apa yang u nak...
    Thank you coz sudi singgah this topic..

    Actlly my problem is.. i want to break up reports by month using php n mysql..
    and the result will be like this..

    $row = mysql_fetch_row($result);
    $count = $row[0];

    Month: January
    Total:
    <?php
    echo ":".$count."";
    ?>

    Month: February
    Total:
    <?php
    echo ":".$count."";
    ?>

    dan
    .
    .
    .
    .

    sampai december..

    i know the sql statement for the total (if i'm not wrong) but

    the result to call by month i didn't get how to retrieve it like above..

    can somebody help me...

  5. #5
    Join Date
    Mar 2008
    Location
    pd
    Posts
    497
    Rep Power
    150
    You need GROUP BY

    So something like:

    SELECT month(birth_daste), count(id) from employee group by month(birth_date)

    If you also need to total up your groups, read about WITH ROLLUP

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. CPC/CPM/CPV,Bi-weekly payments,make money with your website
    By realcash in forum Other Webmaster-related Services and Promotion
    Replies: 0
    Last Post: 31-03-2009, 11:48 PM
  2. Bloggers Salaries Report
    By limcs in forum Blogging Discussion
    Replies: 11
    Last Post: 03-10-2007, 11:53 PM
  3. What about a monthly newsletter?
    By limcs in forum FeedBack & Suggestion
    Replies: 15
    Last Post: 05-04-2007, 11:21 AM
  4. The weekly funnies!
    By mikeyboy82 in forum Mamak Stall
    Replies: 0
    Last Post: 02-02-2006, 07:00 AM
  5. crytal report
    By linux_rock in forum Website Programming
    Replies: 1
    Last Post: 23-08-2005, 05:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112