I think I'm on the right track but still in question

After all the joins I added a "and LocationState = x".
 I'm not totally sure, because I want to search for
records based on (for now)3 conditions (state, city,
industry).
Two things I should mention , the somewhat strange
notation is becaue I'm using one of dem fancy visual
query editors. Secondly, I'm using this query in a web
page that receives the codes via url / variables.
So, and I hope I don't get slammed for talking web dev
here.  But the problem is someone may choose one field
and not another , so I want a return on whether they
chose 1 or all 3 variables.  Hope that makes sense.
i.e. They choose the state, but leave the city and
industy blank.  The way it's set up now with and ...,
and ..., and .... it will only return a record if I
put in all 3. If I do an OR, then a second on any
additonal OR's would get bypassed if I understand
correctly.

Sorry, I might just be thinking outloud.
Please do not boot.
Stuart
--- Stuart Felenstein <[EMAIL PROTECTED]> wrote:

> I'm hoping I can present this correctly.  I'm trying
> to determine how to set up my where condition as, 1
> way has already failed me.   While I continue to
> figure this out (i'm a noob), I hope asking for some
> advice here won't be too awful.
> 
> There is one main table where data is inserted and
> that I'm querying against, but this main table is
> comprised of ID's from other "static tables".
> 
> VendorJobs is the main table, here is the select and
> from's:
>
------------------------------------------------------
> SELECT 
>   `VendorJobs`.`JobID`,
>   `VendorJobs`.`Entered`,
>   `VendorSignUp`.`CompanyName`,
>   `StaIndTypes`.`CareerCategories`,
>   `StaUSCities`.`City`,
>   `USStates`.`States`,
>   `VendorJobs`.`AreaCode`,
>   `staTaxTerm`.`TaxTerm`,
>   `VendorJobs`.`PayRate`,
>   `staTravelReq`.`TravelReq`,
>   `VendorJobDetails`.`JobTitle`,
>   `VendorJobDetails`.`Details`,
>   `VendorJobs`.`PostStart`
> FROM
>   `VendorJobs`
>   INNER JOIN `VendorSignUp` ON
> (`VendorJobs`.`VendorID` =
> `VendorSignUp`.`VendorID`)
>   INNER JOIN `StaIndTypes` ON
> (`VendorJobs`.`Industry`
> = `StaIndTypes`.`CareerIDs`)
>   LEFT OUTER JOIN `StaUSCities` ON
> (`VendorJobs`.`LocationCity` =
> `StaUSCities`.`CityID`)
>   LEFT OUTER JOIN `USStates` ON
> (`VendorJobs`.`LocationState` =
> `USStates`.`StateID`)
>   LEFT OUTER JOIN `staTaxTerm` ON
> (`VendorJobs`.`TaxTerm` = `staTaxTerm`.`TaxTermID`)
>   INNER JOIN `staTravelReq` ON
> (`VendorJobs`.`TravelReq` =
> `staTravelReq`.`TravelReqID`)
>   INNER JOIN `VendorJobDetails` ON
> (`VendorJobs`.`JobID` = `VendorJobDetails`.`JobID`)
> 
> ----------------------------------------------
> 
> The where condition is going to have multiple
> "AND"'s
> (I've considered UNION but don't think they are
> appropriate here)
> 
> First I should say that run as a complete dump, it
> returns all the records correctly , with all the
> id's
> translated into the correct lable.  i.e  State, CA
> is
> stored in VendorJobs as CA, but in the return (and
> this isn't the greatest example) it's California.
> 
> So now I want to add the where's but doing:
> where `VendorJobs`.`CareerCategories` = Finance is
> returning an error.  I think because VendorJobs only
> knows Finance by Fin.  
> 
> I think what it should be :
> StaIndTypes`.`CareerCategories` = Finance 
> I could be wrong, about to try it.
> 
> What's confusing me is the join, and how the join
> maintains the integrity of the record.  If that
> makes
> sense, cause what I just said, doesn't to me.  Yet,
> that's the only way I could say it for now.
> 
> Alrighty, flame away!!!!
> Stuart
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:   
>
http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to