I am making a seed bank database in which seeds are either collected from location or donated by organization.So I have made a supertype table acquisition and subtypes are collection and donation.
I want to display the information of all seeds regarding their collection and donation. For this I am building a sql query from different tables and displaying it in single form.I cannot make the correct query there is problem in it. Tables in which i am having problem are:
Acquisition:Col l_Don_no.,date, quantity,Accid (it is a supertype table)
Subtypes of this table are:
Collection:Coll _Don_no(foreign key),longitude, latitude,altitu de,town
Donation:Coll_D on_no(foreign key),origin
As seeds are either collected or donated not the both so query i have made is
But it is displaying duplicated and wrong information.I know there is some error in mysql query.when i use AND at the place last "OR" then nothing is displayed.Plz helpout
I want to display the information of all seeds regarding their collection and donation. For this I am building a sql query from different tables and displaying it in single form.I cannot make the correct query there is problem in it. Tables in which i am having problem are:
Acquisition:Col l_Don_no.,date, quantity,Accid (it is a supertype table)
Subtypes of this table are:
Collection:Coll _Don_no(foreign key),longitude, latitude,altitu de,town
Donation:Coll_D on_no(foreign key),origin
As seeds are either collected or donated not the both so query i have made is
Code:
"Select original.Acc_ID, crops.crop_id,crops.common_name,crops.genus,crops.specie, seeds.Seed_ID,acquisition.Coll_Don_no,donation.origin,collection.longitude,collection.latitude,collection.altitude from original,crops,seeds ,acquisition,donation,collection where original.Seed_ID=seeds.Seed_ID and seeds.crop_id=crops.crop_id and acquisition.Acc_ID=original.Acc_ID and (acquisition.Coll_Don_no=donation.Coll_Don_no OR acquisition.Coll_Don_no=collection.Coll_Don_no)"
Comment