I am new to MySQL and I am working with a database system that contains four main tables described here:
http://www.pastie.org/3832181
The table this query works with is here:
http://www.pastie.org/3832184
Seems pretty simple?
The purpose of my query is to grab all the BusinessID for the explicit user, where OpportunityID is NULL, after it has these BusinessIDs, I want it to find the associated BusinessName in the Business table and match this BusinessName with the name BusinessName (Business ) in the EmploymentOpportunity table.
This is my request for this action.
SELECT EmploymentOpportunity.OpportunityID, Business, Description
FROM UserBusinessOpportunity, Business, EmploymentOpportunity
WHERE UserBusinessOpportunity.BusinessID =
(SELECT UserBusinessOpportunity.BusinessID
FROM UserBusinessOpportunity
WHERE UserBusinessOpportunity.UserID=1 AND
UserBusinessOpportunity.OpportunityID is NULL)
AND UserBusinessOpportunity.BusinessID = Business.BusinessID
AND Business.BusinessName = EmploymentOpportunity.Business;
BusinessID. , , , , . 3, 24 8 3.
, .