I have the following query in Access:
SELECT a.interest_pare nt_id, a.interest_elem ent_id, b.alr_category_ id AS
interest_catego ry_id, a.allergy_paren t_id, a.allergy_eleme nt_id,
c.alr_category_ id AS allergy_categor y_id
FROM (AllergyDrugPer mutation AS a INNER JOIN alr_category_dr ug_map AS b ON
a.interest_elem ent_id = b.drug_id) INNER JOIN alr_category_dr ug_map AS c ON
a.allergy_eleme nt_id = c.drug_id
and all is well!
When I create the same query in SQL sever (using the desinger), I get:
SELECT a.interest_pare nt_id, a.interest_elem ent_id, b.alr_category_ id AS
interest_catego ry_id, a.allergy_paren t_id, a.allergy_eleme nt_id,
c.alr_category_ id AS allergy_categor y_id
FROM dbo.AllergyDrug Permutation a INNER JOIN
dbo.alr_categor y_drug_map b ON a.interest_elem ent_id =
b.drug_id INNER JOIN
dbo.alr_categor y_drug_map c ON a.allergy_eleme nt_id =
c.drug_id
The only structural difference I see here is that SQL removed the ( and )
from around the first join and created the double join.
When I run this query I get stuck in a loop and eventually the sever will
time out. If I only have the first join there is no time out issues but of
course the result is not what I desire.
Can someone help me out here and tell me what is wrong with the statement
used in SQL?
Thank you in advance,
Eric
SELECT a.interest_pare nt_id, a.interest_elem ent_id, b.alr_category_ id AS
interest_catego ry_id, a.allergy_paren t_id, a.allergy_eleme nt_id,
c.alr_category_ id AS allergy_categor y_id
FROM (AllergyDrugPer mutation AS a INNER JOIN alr_category_dr ug_map AS b ON
a.interest_elem ent_id = b.drug_id) INNER JOIN alr_category_dr ug_map AS c ON
a.allergy_eleme nt_id = c.drug_id
and all is well!
When I create the same query in SQL sever (using the desinger), I get:
SELECT a.interest_pare nt_id, a.interest_elem ent_id, b.alr_category_ id AS
interest_catego ry_id, a.allergy_paren t_id, a.allergy_eleme nt_id,
c.alr_category_ id AS allergy_categor y_id
FROM dbo.AllergyDrug Permutation a INNER JOIN
dbo.alr_categor y_drug_map b ON a.interest_elem ent_id =
b.drug_id INNER JOIN
dbo.alr_categor y_drug_map c ON a.allergy_eleme nt_id =
c.drug_id
The only structural difference I see here is that SQL removed the ( and )
from around the first join and created the double join.
When I run this query I get stuck in a loop and eventually the sever will
time out. If I only have the first join there is no time out issues but of
course the result is not what I desire.
Can someone help me out here and tell me what is wrong with the statement
used in SQL?
Thank you in advance,
Eric
Comment