Design question, on how to retrieve data from the DB

db , query , design pattern , one to many property Israel
  • 12 years ago
    Hi. i have an entity which has one to many properties: each task, can have more than one recipients. also, each task can have many correspondences associated with it now i have a query which needs to retrieve multiple task records, and for each task retrieve all of it's correspondences and recipients. in another query, i need the recipients but not the correspondences. what is the correct way of doing so (with one DB access of course)? i've thought about a possible way, but i think its not good. What i actually need is the results having a field which is actually a table itself (the recipients field) and as far as i know i can't to id with SQL server , so i though i can create an XML field, and that way for each task record, the recipient field will hold XML that represent it's recipients. i think it's quite efficient because it goes over the tasks table only once, but i also think that there must be a better and nicer way. i'm sure i'm not the first developer that needs to retrieve multiple instances of an entity which has one to many property, so i hope you could help me with this :) thank you very much Nadav.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are 10 types of people in the world, those who can read binary, and those who can't.”