What language/platform are you using? Delphi/Win2000
What database? MS SQL
I have two client datasets that are each the result of a multiple table query. I want to create a third client dataset that is a combined query using parts from each of the previous two.
As this is the object-oriented analysis and design forum, you might just encapsulate the two datasets in a collection and generate the third one from that collection ;-)
Create a view on sql server that is the third look that you want (the combination of the two original datasets), then run your queries for the two seperate datasets from that view.
Don, I'm still a little green with OOP so encapsulating the two datasets in a collection and generating the third one from that collection, is easier said than done. Most of my experience is from Procedural Programming using Pascal. I've only been coding in Delphi using OOP for about 6 mo.
JFrost, when you say create a view on SQL Server, are you saying to make a temp table on SQL? That is what I am trying to avoid. If possible I want to do this without writting to the database and then running another query.
A view is a custom table that holds data based on a query, but its not temp, its permanent, and it also continually updates itself as data is changed within the original tables.
The idea is that your data lives at the table layer, but for certain things (like reports for instance), it may be easier to get the data from a View.
i.e. instead of having multiple sessions running a query like
Select a.ID, a.Name, b.OtherID, b.Name
From sometable a RightJoin othertable b
Where a.OtherID = b.OtherID
you could just run the query off of the view like this:
Select * From someview
Where ID = @SomeNumber
Think of it as another layer above the database tables themselves: the tables hold the raw data, a view can hold a cusomized look of that data, which can have queries run against it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.