Merge two database tables to a third table

I have two tables for an employee database.  I am creating a schedule for a particular days work.  So table 1 is the entire list of employees, and table 2 is an exception table of vacations, sick time off, etc...

I want to be able to create a report for a particular day, merging these two tables, and either removing that person who is on vacation from the report, or making an indication in a datagrid. Once this is viewed, I want the entire datagrid contents dumped to another table for history.
1) Can/Should the initial merge be done with SQL statement, if so how?
2) I have tried doing this cycling through a datareader and stuffing the valid employees into a new datatable, but unfortunately, this is beyond my knowledge so far. And it seems to be incredibly inneffecient.
Any suggestions?
If at first you don't succeed, wait for version 2.
7/23/2004 3:59:07 PM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 48
Get it on Google Play
Get it on Apple App Store

I think doing a SQL is better. As you know the syntax is different for each database, if you can post your database name and the table structure I can help with the SQL. Oracle has MINUS and for SQL server you can do with left outer join.
7/23/2004 6:48:30 PM

This is for .Net 1.1,  2.0 is one line of code :) But here it is for us stuck in 1.1 Land!



private DataTable configueBindableDataTable()


         DataTable dtLocal = this.CheckForOpenPatientAdminQI();

         DataTable dtLocal2 = this.CheckForOpenOutPatientAdminQI();

         DataRow dr;

         foreach(DataRow dr1 in dtLocal2.Rows)


               dr = dtLocal.NewRow();

               for(int i = 0;dr1.ItemArray.Length > i;i++)


                           dr[i] = dr1.ItemArray[i];




      return dtLocal;


2/24/2006 7:04:17 PM

Similar Artilces:

creating a third table from two tables
Hi All,I will like to create a table from two tables this (explained below) way using a stored procedure. Basically i want the stored procedure to return me the third table but i dont know how to do it.Table ATopicID      Topic ----------------------------- 1               Sometopic 12               Some topic 23               Some topic 34              &nb...

How to add the data present in the controls to a table control without any database involvement.
Hi All,i am four controls where i will write the text and once i click the add button those should get added to the table .i want 6 columns fixed in the table and rows as many as required.i tried doing that taking a table server control and able to load the table.but the problem is whenver i am adding a new row the old one is gfetting overwritten by this and at the end i am getting only one row.  System.Web.UI.WebControls.Table t1 = new System.Web.UI.WebControls.Table();  i have declared the below one global TableRow tr; TableCell tc1; TableCell tc2; TableCell tc...

masterpage and control formatting (table control, HTML table control)
I have a master page that contains 1 contentplaceholder.  In my default.aspx (that uses the masterpage layout) I have a table server control.  During page_load I get the data I need and repeatedly add the usercontrol to the table control, one user control per row.  My user control is basically a HTML table with several rows and columns that's populated with data upon creation. I want this table to fill the contentplaceholder's width. In addition within the masterpage I have a CSS link for my stylesheet. Here are my questions: Is there a better way of adding ...

How to insert into two tables at (Master table and Detail table)
I was hoping that the would have had a tutorial for inserting into a MasterRecord and DetailRecord.  I have a page that I am working on that is a Reciepe. The Master Record has details such as customer, mix name, create date. The Detail Records has Ingredient Name, Ingredient Amount, etc. I have been following the DAL and BLL concept of the tutorials. Does anyone know of an example that I can follow of setting up two tables and inserting into two tables from the same Button_click event. Thanks, John Hi jfeeney, You just need to reme...

The same table (Table) cannot be the child table in two nested relations.
Hi, I"m getting this error when trying to load an XML document from a third party. I don't have the option of asking them to rename anything. Here's what i'm trying to accomplish. DataSet _ds = new DataSet(); _ds.ReadXml(URL, XmlReadMode.InferSchema); I tried InferSchema, IgnoreSchema and, of course, Auto. I got the same error w/ Infer as Auto (above). With Ignore, I got an empty DataSet. Please help!!! Thanks, kyle.kyleRoche Get that url, and dump it to the browser. It seems like it's not meant to be loaded into a dataset. Or it's...

Tables?! Why Tables?!
Bit random...but why does everything have to be rendered as a table?  It's starting to get quite annoying.  Formview - does this need to be a table?  the Menu??  Wouldn't it make sense to allow the option to...say...not render a Menu as a table?  Am I the only one that thinks this or are there others? You can use CSS Adapters to create your own adapters to override how the controls render it self. In the next version of ASP.Net, you will probably have more flexibility to specify the surrounding elements of th...

From Table to Table
I am working in Delphi 4 and ran into a roadblock I am unfamiliar with. I am trying to search and find values in one table based off of matching values in another. For example a table of objects with fields like name, description, type, ect; and a table of object properties in which each object can be represented multiple times based on the settings on the page at the time. So if i search the object property table (and eventually loop through to repeat for all objects) to find all cases of visible objects when a certain criteria is met. It stops on the first object with "Yes" in th...

Reverse Engineer created copies of table (table:1, table:2)... How do I merge them back into 1 table?
PowerDesigner 12.1 I just reverse-engineered about 20 tables from our database, and it took one of my key tables and created two copies ("TableName : 1" and "TableName : 2"). I'm sure the engine was trying to make the diagram easier for it to auto-layout, but I want all the FKs and such from one table). How do I merge them back into just one table? Thanks, Jason Jason Vogel wrote: > PowerDesigner 12.1 > > I just reverse-engineered about 20 tables from our database, and it took > one of my key tables and created two copies ("Tabl...

Can I use a single database both for the tables created automatically for Login Control and my own tables
Can I have a single database containing both set of tables i.e. Tables, stored procedures created automatically after configuring  ASP.Net Configuration My own tables Because I want to authenticate the users through Login Controls, but also want to fetch data from my own tables. How should i Configure the web.config file to make a connection to the database before the user is authenticated. How should I access the connection string so that I can fetch the data and display it on the same page where the Login Control has been placed.Akber Ali Using a single database is no differe...

how to insert data into two table when two tables depend on each other?
suppose there are two table called tableA and tableB and the situation is the primary key of tableA is a foreignkey of tableB and the primary key of tableB is a foreignkey of this type of situation how we can insert data into 2 tables called tableA,tableB.pls tell me how can i handle this situation very efficiently.explain in detail........plzzzzz. Hello my friend, What you are suggesting is a many-to-may relationship, which is bad.  If you really need to do it this way, you need to remove the constraint so that the fields are there to query but the relationships are n...

one table into two tables
I currently have a company table that contains mulitpal entries of one company because of multipal contacts for that company. I need to take the data from this one table and put it into two two tables, a company table and contact table. Is there any way to do that with an SQL statement? Or do I need to write some real code? Sam Carleton I think you could write a whole airline reservation system just using Watcom SQL... :) Seriously, check out INSERT...SELECT in the Help... ASA User's Guide PART 2. Working with Databases CHAPTER 9. Adding, Changing, and Deleting...

Database table to formview to other table
Okay here's my situation I'm trying to make a page that the user is presented witha a single text box. This text box would be used to entering problems, complaints, etc. Apon Pressing insert there is a number of other fields that would be hidden that would be used to create a complete ticket to be written to a ticket database, this information would be pulled from a USer database using the User's login... Where I'm at... I currently am Using a Select statement for my User table, and an Insert Statement for my Tickets table. They are both in the same datasource and using Us...

Database tables and lookup up tables?
Ok say I would like to build a table for of the following questions(say 6 questions for the sake of argument): Do I just stored the index of the radiobuttonlist. What are some resources that I could look at. Should I make a look up table. 5) If money were no object, I would live . . . Prefer not to say On a tropical island In a New York penthouse In an English castle On a Texas ranch In a Malibu beach house In a mountain retreat (Selected) On the moon None of the above 1 ---> 2 ---> 3 ---> 4 ---> 5) --->6 ...

How to synchronize two table in two database
Database : Sybase 11.0 I have an application in our LAN network, also I have a website on internet(Database is My SQL), I want to distribute one table(I.E. te table which record warehouse information ) to internet database, How to Synchronize these two tables? Thanks in advance! Best regards! Jimmy Nie Does My SQL supports bulk-copy? Check bcp utility in sybase. If it supports 1.bcp out complete table from sybase using -c option or if you want to bcp out only a days worth data (or daterange), then first select with where clause into a temp table and...

Web resources about - Merge two database tables to a third table -

Database - Wikipedia, the free encyclopedia
... requiring information. For example, modelling the availability of rooms in hotels in a way that supports finding a hotel with vacancies. Database ...

Database - Wikipedia, the free encyclopedia
A database is an organized collection of data . The data are typically organized to model aspects of reality in a way that supports processes ...

Social Side of Code, Database CI and REST API Testing in Methods & Tools Winter 2015 issue
... for software developers, testers and project managers – has published its Winter 2015 issue that discusses the social side of code, database ...

Dodgy database exposes details of 191 million US voters
... years, there's a high chance that your personal details are now out in the wild. Security researcher Chris Vickery found a misconfigured database ...

Huge database of 191 million U.S. voters found on the open Internet
... such bulk information online, a recent discovery seems to indicate. According to VentureBeat , a security researcher found the exposed database ...

IDG Contributor Network: Shrinking an already ginormous SharePoint database transaction log
Last month, I wrote about how to avoid having ginormous transaction logs within SharePoint databases. But what if it’s too late, and your files ...

Massive Voter Database Left Open For Public Consumption
Gosh, we could have avoided all the angst about the Clinton/Sanders voter database breach if only we'd known about this major database , accessible ...

Database configuration issues expose 191 million voter records
A misconfigured database has led to the disclosure of 191 million voter records. The database, discovered by researcher Chris Vickery, doesn't ...

Botched database leaks records for 191 million voters
... sometime this century? If so, your personal info may be out in the open. Researcher Chris Vickery has discovered that a badly configured database ...

191 Million US Voter Registration Records Leaked In Mystery Database
A huge database of 191 million US citizens is uncovered. But no one knows who carelessly left it open, whilst the FBI have been contacted.

Resources last updated: 1/14/2016 1:25:02 PM