semi star gazer wrote:
> I have attached the error and the query, but my big
question is,
> why do some records work and others do not?
There are a number of potential problems with those queries.
1) Does the "practiceTypeID" column always have a value?
Empty or null values would likely cause a syntax error in the
second query.
2) A column named "id" exists in both the mentors and
practiceType table. Because you are using
SELECT mentors.*, (ie select all columns), the query results
contain two columns with the same name: "id". That may is cause
issues.
Use a column list instead, and eliminate any duplicate column
names by using aliases.
Aliases let
you assign a different name to an object within a query.
SELECT
mentors.id,
practiceType.id AS PracticeTypeID, <!--- use an alias to
rename the column "PracticeTypeID" --->
... other columns ...
FROM mentors,
internOps_new,
practiceType,
practiceArea
WHERE
.... other conditions ...
3) Your query appears to be missing some join conditions.
There are four (4) tables in the FROM clause but only three (3)
conditions in your WHERE clause. So the query may return too many
records. How are the tables related?
> getPracticeID
4) Since you are already retrieving "practiceTypeID" in the
first query, what is the purpose of the "getPracticeID" query?