Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

DB/2 SQL- Herausforderung

Empfohlene Antworten

Veröffentlicht

Hallo :-)

Hab mich ganz frisch im Forum angemeldet, und brauch eure Hilfe.

System: DB/2 von IBM.

Das Problem das ist, dass ich die Abfrage aus einer Tabelle mache, nämlich aus tabelle1. Also tabelle2 existiert nicht.

Ziel ist also folgendes:

Spalte 1: (Datum DD/MM/JJ) von Tabelle01

Spalte 2: (erflogreiche Suche (>0 Hits)) von Tabelle01

Spalte 3: (Null_Suche (=0 Hits)) von Tabelle01

Mein Ansatz bisher:

db2 "select tg.datum, count(td), count(tg) from

table(select datum, count(*) from tabelle where treffer = '0' group by datum) as td,

table (select datum, count(*) from tabelle where treffer > '0' group by datum) as tg

where td.datum = tg.datum group by tg.datum"

Fehler: SQL0206N "TD" is not valid in the context where it is used. SQLSTATE=42703

oder anderer Ansatz:

db2 "select tg.datum, count(td.datum) as AnzTab1, count(tg.datum) as AnzTab2

from table1 as td, table2 as tg

where td.datum = tg.datum AND td.treffer = '0' AND tg.treffer = '0'

group by tg.datum"

Ich bin ratlos :unsure:

Und wenn mir jemand helfen kann, bin ich echt dankbar ;)

liebe Grüße

MaXi


db2 "select tg.datum, [B][COLOR="Red"]td.treffer[/COLOR][/B], [B][COLOR="Red"]tg.treffer[/COLOR][/B] from

table(select datum, count(*) [b][COLOR="Red"]treffer[/COLOR][/b] from tabelle

where [B][COLOR="Red"]treffer = 0[/COLOR][/B] group by datum) as td,

table (select datum, count(*) [B][COLOR="Red"]treffer[/COLOR][/B] from

tabelle where [B][COLOR="Red"]treffer > 0[/COLOR][/B] group by datum) as tg

where td.datum = tg.datum group by tg.datum"


oder mit count(td.*) anstelle von count(td)...

Wow, danke für die schnelle Antwort.

Ich hab mal das Ergebnis als .pdf angehängt. Irgendwie ist die Ausgabe unkorrekt.

Ergebnis (1).pdf

Ich hab die Lösung :-)

db2 "select tg.datum, sum(td.treffer), sum(tg.treffer) from

table(select datum, count(*) treffer from tabelle

where treffer = 0 group by datum) as td,

table (select datum, count(*) treffer from

tabelle where treffer > 0 group by datum) as tg

where td.datum = tg.datum group by tg.datum"

Vieeeeelen Dank

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.