Results 1 to 3 of 3

Thread: count, sum etcc with query and join

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,586

    Red face count, sum etcc with query and join

    I need a query (SQl="....") to use in VB6 and ADO.

    in Access database have table VERS and table ANAG.
    all tables contain the same field RAPPORT (Indexed)

    in VERS have fileds NR_ASS and IMP_ASS
    in ANAG have fileds NR and TOT_ASS

    Now with a Join VERS.RAPPORTO<>ASS.RAPPORTO, i need to update ANAG.TOT_ASS with the sum of VERS.IMP_ASS and ANAG.NR with the count of VERS.NR_ASS ...

    Tath is all :-)
    Last edited by luca90; Dec 14th, 2017 at 12:50 AM.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: count, summ etcc qith query and join

    You would not be using a join you would be using an update. Can't tell from what you posted as you say you have two tables but there appear to be three tables referenced in your description

    That said it would be something along the lines of

    Update Table1 set Field1=(Select count(someField) from Table 2 Where something), Field2=(Select Sum(somefield) from table 2 where something ) where something

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,586

    Re: count, summ etcc qith query and join

    Quote Originally Posted by DataMiser View Post
    You would not be using a join you would be using an update. Can't tell from what you posted as you say you have two tables but there appear to be three tables referenced in your description

    That said it would be something along the lines of

    Update Table1 set Field1=(Select count(someField) from Table 2 Where something), Field2=(Select Sum(somefield) from table 2 where something ) where something
    Hi bro i can send in private my test of mdb?
    the database contain reserved data:-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width