Looking at the original data, how do you know which exit time goes with which entry time? There seems to be no logical pattern for eid=102. ie, both exit times for eid=102 are later than both entry times for eid=102. How do you coorelate the entries?
Is there a reason that you have two seperate tables to begin with, instead of one table like t3?
the values are doesn't matter i want to know how the two tables are inserted into the third table
Ah, but the values do matter. Your previous SQL statement takes all of the data from T1 and joins it with all of the data from T2 where the eids are the same. For eid=101 you have two rows in T1 and two rows in T2, if you join these together, you get a four row result set. However, you indicated that you want a two row result set. To acheive this, you need to join one row in T1 with one row in T2.
As George and I have asked, what logic do you use to decide which row in T2 gets paired to which row in T1. The biggest part of the battle is clearly articulating the logic behind choosing wich rows make a pair. Once you have done that, it's just a matter of writing the SQL statement to implement that logic. Does that make sense?
i want to minus the first entry time with the exit time , but it is impossiable,
u hav an idea ,
i am working for a time management to calucate how hours employee worked in the office for this the difference is imp
OK, now we may be getting somewhere. Let's assume, for this discussion, that all eid's for the entries being discussed are the same, say 101. Let's also assume that there are two rows in the entry table, referred to as entry1 and entry2, and two rows in the exit table, referred to as exit1 and exit2. Let's also assume that the first row in each table is at a time that is earlier than the second row, for example, entry1 < than entry2.
Given this scenario as a starting point:
1. Does this represent the real world data?
2. Can you gaurantee that entry1 < exit1 and exit1 < entry2 and entry2 < exit2?
3. If that is true, can you say the same is true for any number of rows in the entry table and exit table (Again, assuming the same eid for the rows being considered)?
Asnwer these questions and we'll continue from there.