Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
maddyslayer
Yak Posting Veteran
57 Posts |
Posted - 2012-03-19 : 16:24:26
|
I need the query joining three tables. Three tables are UtilityIndustry, UtilitySubIndustry, UtilityRegStatus.Columns in Utility Industry are Industryid and UtilityidColumns in UtilitySubIndustry are Industryid, Subindustryid and RegstatusidColumns in UtilityRegStatus are Regstatusid, Subindustryid and Statustype.How do i get all the records from the table Utility Industry with Statustype='3'? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-19 : 16:30:48
|
simple join involving all tables on related column with a where condition for your filter will give you required data------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
sqllearner05
Starting Member
9 Posts |
Posted - 2012-03-20 : 06:27:03
|
below is join of 3 tables.. modify it according to ur requirementSELECT UI.* FROM UtilityIndustry UIINNER JOIN UtilitySubIndustry USION UI.Industryid = USI.IndustryidINNER JOIN UtilityRegStatus URSON USI.Subindustryid = URS.SubindustryidAND USI.Regstatusid = URS.RegstatusidWHERE UI.Statustype = '3'sqllearner |
 |
|
maddyslayer
Yak Posting Veteran
57 Posts |
Posted - 2012-03-20 : 10:36:00
|
Thank Youquote: Originally posted by sqllearner05 below is join of 3 tables.. modify it according to ur requirementSELECT UI.* FROM UtilityIndustry UIINNER JOIN UtilitySubIndustry USION UI.Industryid = USI.IndustryidINNER JOIN UtilityRegStatus URSON USI.Subindustryid = URS.SubindustryidAND USI.Regstatusid = URS.RegstatusidWHERE UI.Statustype = '3'sqllearner
|
 |
|
|
|
|