Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with Stored Procedure
Message
 
 
À
02/02/2011 09:31:12
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01498262
Message ID:
01498297
Vues:
34
>>I'd say, if the design requires this complicated algorithm, it may be not a good design.
>>
>>Anyway, here is a possible solution
>>
>>
>>select HouseHoldID, ApplicantID from HouseHold where ApplicantID = @PersonID
>>UNION  -- UNION removes duplicates
>>select HouseHoldID, PersonID from HouseHoldMembers where PersonID = @PersonID
>
>
>Hi Naomi,
>Thanks. I am not sure why it is complicated though. The solution that Sergey gave me worked and didn't seem complicated. Am I missing something?
>Tim

May be it's OK for this particular case, but I prefer to store information related to an entity in one table and therefore always retrieve it from one table.

BTW, I think for your case you still don't need to go to the first table and will always retrieve it from the second if it describes all people (main applicants or not). In other words, on the second thought just do a search in the HouseHoldMembers for the PersonID.
On the other hand, the Household table may be smaller than HouseHoldMembers table, so it may make sense to check it first.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform