0

Table users

id     username           password
----------------------------------
1      email@yahoo.com    admin
2      email1@yahoo.com   password
3      example@m.com      admin123

Table employer-profile

id     u_id   company-name       logo
-----------------------------------------
1      2      Blue Rays Graphics logo.jpg
2      1      Hire Me to do best logo.jpg
3      3      example.com        logo.jpg

Table employer-post-job

id     e_id   job-title     job-category    expire date
-------------------------------------------------------
1      2      web-developer IT              2013-9-5
2      1      receptionist  media           2013-9-5
3      2      web-designer  IT              2013-9-5

In this table I want to list data in index page like this

------------
|          |  Blue Rays Graphics
|   logo   |
|          |
------------

------------
|          |  Hire Me to do best
|   logo   |
|          |
------------

Here in this table I want to list employer which job is not expired and if expired all job posted by employer than only hide employer list I want it through mysql query to list in CI Framework.

I tried this

SELECT *
FROM employer_profile
WHERE u_id IN
        ( SELECT DISTINCT u_id
         FROM employer_profile
         INNER JOIN
             ( SELECT e_id,
                      COUNT(*)
              FROM employer_post_job
              WHERE dead_line >= CURDATE()
              GROUP BY e_id )
         INNER JOIN users ON employer_profile.u_id = users.id);
4

1 回答 1

0

试试这个查询,如果您仍然遇到问题,请告诉我,因为我无法执行它。

Select * from users u 
          inner join employer-profile e ON u.id = e.u_id
          inner join employer-post-job epj ON e.u_id =epj.e_id
          where epj.expire date > '".date('Y-m-d')."' 
于 2013-09-06T11:53:23.817 回答