Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best Practice For the Following Scenario
Message
De
25/03/2003 14:36:16
Jason Dalio
Northern Interior Regional Health Board
Prince George, Colombie Britannique, Canada
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Titre:
Best Practice For the Following Scenario
Divers
Thread ID:
00769884
Message ID:
00769884
Vues:
48
Hi SQLers. I am writying an app using a Visual Basic front end to do the queries bu ti wanted to hit up the SQL knowledge here to see if I can make this more efficient. Here is the simplified version.
--------------------------
Table1: Activities

ActivityID
ActivityDesc
--------------------------
Table2: StaffActivities

StaffID
ActivityID
IsVisible
--------------------------
Table3: Data

Date
StaffID
ActivityID
Value
--------------------------
On the form there is a grid that i want to show all of the values in activities and all of the values from Table3 where the StaffID, ActivityID and Date match for the current selected date. Right now I am having to use 3 separate queries and code manipulation to achieve this. I keep thinking there must be a better way.

I'm using the following query to get the main results:
SELECT Activity.ActivityDesc, Activity.ActivityDesc, Data.Value, StaffActivity.IsVisible
FROM Activity INNER JOIN (StaffActivity INNER JOIN Data ON (Data.ActivityID = StaffActivity.ActivityID) AND (StaffActivity.StaffID = Data.StaffID)) ON Activity.ActivityID = Data.ActivityID
WHERE (((Data.StaffID)=5))
This of course only gives me values where there is an entry in the StaffActivities table. I want the users to always see the full list of Activities (in case someone adds a new one in after the fact) reagardless of if they have gone into their profile to mark activities as visible or invisible.

I know this message is kind of convoluted but i hope it conveys my meaning anyway. Thanks.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform