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 |
|
lucsky8
Posting Yak Master
105 Posts |
Posted - 2011-04-06 : 10:43:40
|
Here what i need to do!I am doing application in .net and Sql serverThe appliaction is simple there a treeview with checkbox.There a parant node "Region" and child node "Ecole"Ecole = SchoolEach school is link to a regionWhen the user submit the form all the school that are check is inserted in the tblRegionEcoleHere my table The user check all the check box he want. He can check a single school or if he check the parent node it will check all the school for him.When he click submit all the school are inserted in the database.Then the part i want to do is sent email with the infoSo my query look somthing like this SELECT tt.intTempeteId,tt.datDateTempete,te.strNom,reg.strNomFROM tblTempete as ttINNER JOIN tblRegionEcole as re ON tt.intTempeteId = re.intTempeteIdINNER JOIN tblEcole as te ON re.intEcoleId = te.intEcoleIdINNER JOIN tblRegion as reg ON reg.intRegionId = te.intRegionIdWHERE tt.datDateTempete = '2011-04-05' So now here what i looking to do!Instead of using the query above, i want to create a query that will check ifAll the "te.strNom" school from a "reg.strNom" region is in the resultEx:If all the School from a "Région de Shédiac" region is in the result show me the regionis close.But if only 3 school out 6 is in the query show me all the school in the query.Number 6 can vary depenging from the regionSo if you look at the second picture it will return something like thisBecause in "Region de Shediac" there a total of 6 school in the tableAnd for "Région de Saint-Louis de Kent" the user only check 2 school so the query will return The result i wantRegion de shediacÉcole Soleil LevantÉcole La Marée MontanteTks for your help in advanceDo you think it possible!Luc |
|
|
slimt_slimt
Aged Yak Warrior
746 Posts |
Posted - 2011-04-06 : 12:08:01
|
| Hi Luc,i just want to clarify:- if user clicks on one school, you want to return all the schools from region? or- if user clicks on one region and there is vacancy in one of the schools from this region, return name of this region?sorry, i got confused :( |
 |
|
|
lucsky8
Posting Yak Master
105 Posts |
Posted - 2011-04-06 : 12:22:41
|
Sorry i did't explain my self correctly!The goal of my apps is to send an email to tell if the certains school are close.The email will show all the school that are close.But we have a lot school.Each shool is link to a region-In the email if all the school from a region are close "check" then in the message will say that this region is close-But if only 2 or 3 school is close from region it will list all the schoolIn the treeview each school is link the unique ID That the id that is inserted in the databseSo the region is only there because it faster for the userIf the user click on a region all the school selectedBut in the database it will insert the unique id for the schoolI need to find a way toDo understand more what i am trying to do?Tks for your help!I hope i explain my self the right way! :)quote: Originally posted by slimt_slimt Hi Luc,i just want to clarify:- if user clicks on one school, you want to return all the schools from region? or- if user clicks on one region and there is vacancy in one of the schools from this region, return name of this region?sorry, i got confused :(
|
 |
|
|
lucsky8
Posting Yak Master
105 Posts |
Posted - 2011-04-06 : 12:28:08
|
Here i hope it help!As you can seeEx:Region de Shediac is all checkAndRegion de Bouctouche there only 2 schools that are checkAll the id from the school that are check are inserted in th DBSo want a query that will return If it not possible in one query is it possible to do 2?One that show if a region is closeOne if some school are close?Any idea?Region ShdeiacEcole Camille-VaoutourEcole Mont-Carmel |
 |
|
|
lucsky8
Posting Yak Master
105 Posts |
Posted - 2011-04-06 : 12:54:56
|
| Any idea how to start my query?Any help would be appreciateTks in advance! |
 |
|
|
|
|
|
|
|