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.

Schwieriges SQL Statement über 4 Tabellen

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich habe ein größeres SQL Problem. Ich möchte aus Daten, die über 4 Tabellen verstreut sind zwei Informationen herausziehen.

Ich habe folgende Tabellen:

hc_offer:

nID INTEGER PRIMARY KEY,

FK_USER_Create_ID INTEGER,

...

hc_position :

nID INTEGER PRIMARY KEY,

nAmount INTEGER ,

FK_ASSEMBLY_ID INTEGER

...

hc_userdef_assembly:

nID INTEGER PRIMARY KEY,

FK_ASSEMBLY_Original_ID INTEGER,

doTotalPrice DOUBLE

hc_cross_offer_position:

FK_OFFER_ID INTEGER,

FK_POSITION_ID INTEGER

Ich möchte nun die Gesamtanzahl aller hc_offer's eines Benutzers ermitteln (ID = 11) und zusätzlich die Summe seiner Preise doTotalPrice aus hc_userdef_assembly. Ich habs wie folgt versucht. Die Anzahl stimmt, aber die Summe überhaupt nicht.

SELECT COUNT ( hc_offer.nID ) , SUM ( hc_userdef_assembly.doTotalPrice )

FROM hc_offer , hc_cross_offer_position , hc_position , hc_userdef_assembly

WHERE hc_offer.FK_USER_Create_ID = 11 AND hc_cross_offer_position.FK_OFFER_ID = hc_offer.nID AND hc_position.FK_ASSEMBLY_ID = hc_cross_offer_position.FK_POSITION_ID AND hc_position.FK_ASSEMBLY_ID = hc_userdef_assembly.nID

Kann mir einer einen Tipp geben?? Mach jetzt schon seit geraumer Zeit dran rum und komm auf keinen grünen Ast.

was fuer ein dbms, also hast du subqueries zV ?

wenn ja schreib ich dir auch wies dann geht

DBMS ist SQLite, es sollte aber auch mit MySQL 4.x funktionieren...

Hallo,

ich habs jetzt einzeln gemacht. Trotzdem danke für die angebotene Hilfe

Timo

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.