SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    query 3 tables to retrieve fields value and display table in a page

    hi..

    Im new to mysql..i want to know how to generate daily reports for all employees

    i created 3 tables with fields

    employee table:emp_id,name
    job table:job_id,job_name
    activity table:act_id,emp_name,job_name,date,activity done(assigned values as email,phonecall,visits)

    Daily Activity Report : (Employee ID, Emp Name,Jobs Name, Activity Done)
    Eg: 1.| Date | Rajeev | Income Tax Filing | Phone Call
    Options to Select : 1. Which Date (Required - Not Null) 2. Employee Name,
    if Employee Name not selected, then the list of Activities for that day for all Employees.

    How to write query

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,014
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    this is a homework assignment, isn't it

    what have you tried so far?
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,398
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    The third table is not correct. You are using the employee name and job name as foreign keys to the employees and jobs table, instead you should be using the employee id and job id.


Bookmarks

Posting Permissions

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