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);