BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Update A table with another.

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Sat Dec 09, 2006 2:11 am    Post subject: Update A table with another. Reply with quote



Hi

I use ado and connect mdb file thorough ms jet engine

I have two table

T1 have 4 fields
1 : Id : Int
2: name : str
3: sum1 : double
4:sum2 : double

T2 have 3 fields
1: T1id : int
2:Amont : double
3: tType : int

the records on t1 are like

1 Record1 10.00 5.00
2 Record2 3.00 2.00
.....


the records on t2 are like
1 12.00 1
1 8.00 1
1 5.00 2
2 5.00 1
....


what i want to do within one sql sentence
sum T2 group by T1id where ttype = 1 and write to T1's sum1
sum T2 group by T1id where ttype = 2 and write to T2's sum2
do this for each record on T1, if not exists on t2 set Sum1 or/and Sum2 to
zero


best regards
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.