472,119 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

My Select Query is not working. Pls Need Help ...!

I have two tables naming
1.) Criteria and 2.) IndicatorData.

Criteria table has (CriteriaID, CriteriaName,CriteriaValues) Fields.

Example( CriteriaName-'Gender 'and values would be 'Male' and 'Female' and CriteriaName-'AgeGroup1' and Values-'<30','30-40','40-50','+50').

IndicatorData table has fields such as (IndicatorDataID, IndicName, Criteria_Code1,Criteria_Value1,Criteria_Code2,Crit eria_Value2,Criteria_Code3,Criteria_Value3, IndicValue).

Example-(IndicatorDataID-'ind001', IndicName='No. of participants', Criteria_Code1-'Gender',Criteria_Value1-'Male' and IndicValue-200.)

I took two reference Criteria tables naming Criteria1, Criteria2 apart from the main Criteria table and link those three tables with the IndicatorData table.
I made the relationship between the IndicatorData and the Criteria as 1 to many where Criteria_Code1,Criteria_Code2 and Criteria_Code3 fields of IndicatorData table reference to the CriteriaID of Criteria,Criteria1,Criteria2 tables.

I made the sql qury to get all Criteria Names belong to a particular IndicatorDataID but it didnt work. my query is


"SELECT Criteria.tCriteriaName
FROM Criteria INNER JOIN IndicatorData ON (Criteria.nCriteriaId = IndicatorData.CriteriaCode5) AND (Criteria.nCriteriaId = IndicatorData.CriteriaCode4) AND (Criteria.nCriteriaId = IndicatorData.CriteriaCode3) AND (Criteria.nCriteriaId = IndicatorData.CriteriaCode2) AND (Criteria.nCriteriaId = IndicatorData.CriteriaCode1)
WHERE (((IndicatorData.nIndicatorId)=9));"


IS IT POSSIBLE TO GIVE THE RELATIONSHIP BETWEEN INDICATORDATA TABLE AND CRITERIA TABLE LIKE THAT OR DOES MY SQL QUERY HAVE SOMETHING TO DO WITH IT...?

answer would be greatly appriciated.

Thanx + Regards
Kosala
Sep 17 '07 #1
1 1178
FishVal
2,653 Expert 2GB
Hi, Kosala.

You definitely should take a look at this article
Database Normalisation and Table structures
Sep 17 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

17 posts views Thread by guitarromantic | last post: by
17 posts views Thread by kalamos | last post: by
3 posts views Thread by Tcs | last post: by
12 posts views Thread by bokke | last post: by
3 posts views Thread by shotokan99 | last post: by
6 posts views Thread by dbuchanan | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.