Posted August 28, 2015
Very Off-topic, but I think this community is the sort that could help me out!
I'm doing an MSc and part of my project requires me to build a database of various genomes and be able to filter it for various bits of information. I'm trying to do this with sql scripts. I have no computing experience so this is all knew to me. I'm mostly googling business sql forums to see what scripts can be transferred but I've run into a problem I can't find a fix for elsewhere.
This is the current script I'm working on:
SELECT * FROM "Gar" JOIN "Chi" ON "Gar"."Gar Key" = "Chi"."Chicken Key" JOIN "Hum" ON "Gar"."Gar Key" = "Hum"."Human Key" WHERE "Chi"."Orthology confidence [0 low, 1 high]" = '1' OR "Chicken Ensembl Gene ID" IS NULL AND "Hum"."Orthology confidence [0 low, 1 high]" = '1' OR "Human Ensembl Gene ID" IS NULL ORDER BY "Gar"."Ensembl Gene ID"
I have three tables: Gar, Chi, and Hum. I need to take information from Chi and from Hum independently and add them to the Gar table. Unfortunately they are interfering with each other. I want gar plus Chi when orthology =1 or when Gene ID is Null. Separately I want Hum when orthology=1 or when Gene ID is Null.
At the moment I'm getting Chi orthology=1 AND Chi orthology=0 when Hum orthology=1.
Ideally I want Gar Join Chi where . . . . . AND Gar join Hum where . . . . . But I can't find the right syntax to stop Chi and Hum from interfering with each other.
I'm doing an MSc and part of my project requires me to build a database of various genomes and be able to filter it for various bits of information. I'm trying to do this with sql scripts. I have no computing experience so this is all knew to me. I'm mostly googling business sql forums to see what scripts can be transferred but I've run into a problem I can't find a fix for elsewhere.
This is the current script I'm working on:
SELECT * FROM "Gar" JOIN "Chi" ON "Gar"."Gar Key" = "Chi"."Chicken Key" JOIN "Hum" ON "Gar"."Gar Key" = "Hum"."Human Key" WHERE "Chi"."Orthology confidence [0 low, 1 high]" = '1' OR "Chicken Ensembl Gene ID" IS NULL AND "Hum"."Orthology confidence [0 low, 1 high]" = '1' OR "Human Ensembl Gene ID" IS NULL ORDER BY "Gar"."Ensembl Gene ID"
I have three tables: Gar, Chi, and Hum. I need to take information from Chi and from Hum independently and add them to the Gar table. Unfortunately they are interfering with each other. I want gar plus Chi when orthology =1 or when Gene ID is Null. Separately I want Hum when orthology=1 or when Gene ID is Null.
At the moment I'm getting Chi orthology=1 AND Chi orthology=0 when Hum orthology=1.
Ideally I want Gar Join Chi where . . . . . AND Gar join Hum where . . . . . But I can't find the right syntax to stop Chi and Hum from interfering with each other.
Post edited August 28, 2015 by MichaelFurlong
This question / problem has been solved by Wishbone
