-

   rss_sql_ru_access_programming

 - e-mail

 

 -

 LiveInternet.ru:
: 16.03.2006
:
:
: 4

:


, 14 2017 . 08:58 +
.
:

strSQL="INSERT INTO tbl_TcIMP ( NumBase, ShpCount, ShpCountU, PrcSum, PrcSumU, WPS, WPSU) 
SELECT tbl_TS.shpConsInNum, Count(tbl_TS.shpid) AS Ord1, Sum(IIf([shpReal]=0,0,1)) AS OrdUch, Sum(tbl_TS.shpPrc) AS Prc, Sum(IIf([shpReal]=0,0,[shpPrc])) AS prcU, Sum(tbl_TS.shpWP) AS [WPS], Sum(IIf([shpReal]=0,0,[shpWP])) AS WPSU FROM tbl_TS
GROUP BY tbl_TS.shpConsInNum HAVING tbl_TS.shpConsInNum<>''"

:
2: ( - [] SUM .
INSERT INTO tbl_TcIMP ( NumBase, ShpCount, ShpCountU, PrcSum, PrcSumU, WPS, WPSU )
SELECT tbl_TS.shpConsInNum, Count(tbl_TS.shpNumber) AS OrdCount, -Sum([shpID]/[shpID]*([shpReal]>0)) AS OrdUch, Sum(tbl_TS.shpPrc) AS [prcS], -Sum([shpPrc]*([shpReal]>0)) AS prcUch, Sum(tbl_TS.shpWP) AS [WPS], -Sum([shpWP]*([shpReal]>0)) AS WPSU FROM tbl_TS GROUP BY tbl_TS.shpConsInNum HAVING tbl_TS.shpConsInNum<>''"

1 10000 . !!!

WHERE - , .
.

:
1. CurrentProject.Connection.Execute strSQL
2. CurrentDB.Execute strSQL
3. DoCmd.RunSQL strSQL

, = 0.

:
    CurrentDb.CreateQueryDef "sql_temp", strSQL
    DoCmd.OpenQuery "sql_temp"
    DoCmd.DeleteObject acQuery, "sql_temp"

. .

(vba) 3- ?

http://www.sql.ru/forum/1257129/vypolnenie-zaprosa-zapushhennogo-raznymi-sposobami


: [1] []
 

:
: 

: ( )

:

  URL