Thema Datum  Von Nutzer Rating
Antwort
22.03.2020 21:12:35 Frank
NotSolved
23.03.2020 06:45:15 Mase
NotSolved
23.03.2020 08:41:56 Frank
NotSolved
23.03.2020 10:01:59 Mase
NotSolved
23.03.2020 12:10:22 Gast8104
NotSolved
23.03.2020 13:08:29 Mase
NotSolved
Rot Parameter
23.03.2020 22:36:36 Frank
NotSolved
24.03.2020 05:49:01 Mase
NotSolved
24.03.2020 09:41:54 Frank
NotSolved
24.03.2020 14:39:59 Frank
NotSolved
26.03.2020 21:28:30 Frank
NotSolved

Ansicht des Beitrags:
Von:
Frank
Datum:
23.03.2020 22:36:36
Views:
505
Rating: Antwort:
  Ja
Thema:
Parameter

Die Parameter Frage ist geklärt, System wollte %2020%

Nachfolgendes Problem

wenn ich die komplexe SQL einstelle bleibt es in der letzeten Zeile stehen (Daten Aktuallisierung kann nicht duchgeführt werden)

Das SQL sieht so aus und funktioniert ohne str = ohne Probleme. hab ich vielleicht sonst mit strSQL einen Fehler eingebaut.

Sub Test()

    With ActiveWorkbook.Connections("Abfrage von PostgreSQL210").ODBCConnection
        .BackgroundQuery = True

strSQL = " select max(serie),  "
strSQL = strSQL & " timestamp, "
strSQL = strSQL & " name, "
strSQL = strSQL & " vorname,  "
strSQL = strSQL & " sum_R, "
strSQL = strSQL & " sum_Z , "
strSQL = strSQL & " Endergeb1, "
strSQL = strSQL & " Endergeb2, "
strSQL = strSQL & " id_training, "
strSQL = strSQL & " wertung, "
strSQL = strSQL & " anzahl, "
strSQL = strSQL & " datum "
strSQL = strSQL & " from  ( "
strSQL = strSQL & " select * "
strSQL = strSQL & " from ( "
strSQL = strSQL & " with x as (select id_training, timestamp, "
strSQL = strSQL & " nr,

strSQL = strSQL & " name, "
strSQL = strSQL & " vorname, "
strSQL = strSQL & " ergebnis_ring, "
strSQL = strSQL & " ergebnis_zehntel, "
strSQL = strSQL & " wertung, "
strSQL = strSQL & " div(row_number() over (partition by  id_training  order by timestamp  )-1, 10) as se "
strSQL = strSQL & " anzahl  "
strSQL = strSQL & " from t_tr, "
strSQL = strSQL & " t_se, "
strSQL = strSQL & " t_sch, "
strSQL = strSQL & " t_diszi "
strSQL = strSQL & " where id_training = t_se.id_se "
strSQL = strSQL & " and id_sch = t_sch.id_schu  "
strSQL = strSQL & " and t_sch.id_schu = t_se.id_schu "
strSQL = strSQL & " and t_tr.id_diszi =  t_diszi.id_diszi "
strSQL = strSQL & " and t_tr.id_typ =2 "
strSQL = strSQL & " and id_training between 3396 and 3397 "
'    strSQL = strSQL & "  and timestamp::date = 'now'::text::date "

'     strSQL = strSQL & " and  CAST(timestamp AS VARCHAR ) > '2020-03-12%' ) "
strSQL = strSQL & " select nr , "
strSQL = strSQL & " timestamp::date as Datum,  "
strSQL = strSQL & " timestamp, "
strSQL = strSQL & " Se, "
strSQL = strSQL & " name, "
strSQL = strSQL & " vorname, "
strSQL = strSQL & " sum(ergeb_r)  over(partition by id_training,se order by id_training) as sum_R , "
strSQL = strSQL & " sum(ergeb_z )  over(partition by id_training,se order by id_training) as sum_Z , "
strSQL = strSQL & " sum(ergeb_r) over(partition by id_training) as End_R, "
strSQL = strSQL & " sum(ergeb_z ) over(partition by id_training) as End_Z, "
strSQL = strSQL & " id_training, "
strSQL = strSQL & " wertung, "
strSQL = strSQL & " anzahl, "
strSQL = strSQL & " row_number() over (partition by id_training,se order by timestamp  ) as ze_se "
strSQL = strSQL & " from x ) mm "
strSQL = strSQL & " where ze_se = 10 "
strSQL = strSQL & " order by shot_timestamp desc,id_training )hh "
strSQL = strSQL & " group by id_training , "
strSQL = strSQL & " Datum, "
strSQL = strSQL & " timestamp, "
strSQL = strSQL & " name, "
strSQL = strSQL & " vorname,  "

strSQL = strSQL & " sum_R, "
strSQL = strSQL & " sum_Z , "
strSQL = strSQL & " Endergeb1, "
strSQL = strSQL & " Endergeb2, "
strSQL = strSQL & " anzahl, "
strSQL = strSQL & " wertung"
strSQL = strSQL & " order by timestamp desc "
.CommandText = strSQL.

        .CommandType = xlCmdSql
        .Connection = Array(Array( _
        "ODBC;DSN=PostgreSQL210;DATABASE=club;SERVER=192.168.10.210;PORT=5432;UID=postgres;;SSLmode=disable;ReadOnly=0;Protocol=7.4;FakeOidInd" _
        ), Array( _
        "ex=0;ShowOidColumn=0;RowVersioning=0;ShowSystemTables=0;Fetch=100;UnknownSizes=0;MaxVarcharSize=255;MaxLongVarcharSize=8190;Deb" _
        ), Array( _
        "ug=0;CommLog=0;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;BoolsAsChar=1;Parse=0;ExtraSysTablePrefixes=;LFCon" _
        ), Array( _
        "version=1;UpdatableCursors=1;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinary=1;UseServerSidePrepare=1;LowerCaseIdentifier=0;D6=-101;Xa" _
        ), Array("Opt=1"))
        .RefreshOnFileOpen = False
        .SavePassword = False
        .SourceConnectionFile = ""
        .SourceDataFile = ""
        .ServerCredentialsMethod = xlCredentialsMethodIntegrated
        .AlwaysUseConnectionFile = False
    End With
    With ActiveWorkbook.Connections("Abfrage von PostgreSQL210")
        .Name = "Abfrage von PostgreSQL210"
        .Description = ""
    End With

.ActiveWorkbook.Connections("Abfrage von PostgreSQL210").Refresh  <<< bleibt an dieser Stelle stehen

Sub End


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
22.03.2020 21:12:35 Frank
NotSolved
23.03.2020 06:45:15 Mase
NotSolved
23.03.2020 08:41:56 Frank
NotSolved
23.03.2020 10:01:59 Mase
NotSolved
23.03.2020 12:10:22 Gast8104
NotSolved
23.03.2020 13:08:29 Mase
NotSolved
Rot Parameter
23.03.2020 22:36:36 Frank
NotSolved
24.03.2020 05:49:01 Mase
NotSolved
24.03.2020 09:41:54 Frank
NotSolved
24.03.2020 14:39:59 Frank
NotSolved
26.03.2020 21:28:30 Frank
NotSolved