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.

Empfohlene Antworten

Veröffentlicht

Wie zähle ich die ausgegebenen Results bei einem gejointen select? Also mein Select sieht in etwa so aus:

SELECT

tabelle1.*,tabelle2.feld1,tabelle2.feld2

So wenn ich das jetzt counten will, wie mache ich das? Weil:

SELECT

count(tabelle1.*,tabelle2.feld1,tabelle2.feld2)

funktioniert ja net.

Da gibt es schon die ein oder andre Möglichkeit, aber interessant zu wissen wäre, womit du das ganze ausgeben willst (PHP?) und welche Datenbank du benutzt (mySQL?)

  • Autor

Dagegen spricht:

ORA-01747: invalid user.table.column, table.column, or columns specification

Ach und ich möchte mir das einfach nur als select ausgeben lassen, also nix php oder so, is alles rein auf datenbankebene und ich benutz oracle 10g

Versuchs mal mit einem Subselect:

select count(tabelle1.*), count(tabelle2.*) from (

select tabelle1*, tabelle2.feld1, tabelle2.feld2 from ...);

Ich weiss jetzt nicht genau ob Oracle da ein Spezialfall ist, aber ich würde das so lösen:

SELECT COUNT(*) AS Anzahl FROM tabelle1.*,tabelle2.feld1,tabelle2.feld2

Danach hast du dann die Anzahl der Records im virtuellen Tabellenfeld "Anzahl "

Oder alternativ per join-verbindung:

SELECT COUNT(*) AS Anzahl FROM tabelle1 INNER JOIN tabelle2.feld1 ON tabelle1.feld1 (je nachdem, welches das join-feld ist)

  • Autor

Hm...das versteh ich nicht wie ich mein statement umbauen soll, also am besten ich zeig es mal komplett:

SELECT

t1.*,t2.spalte3,t2.spalte5

FROM

tabelle1 t1

LEFT JOIN

tabelle2 t2

ON

t1.spalte1 like '%'||t2.spalte1||'%' AND

t1.spalte2 = t2.spalte2 AND

t1.spalte4 = t2.spalte4 AND

t1.spalte5 = t2.spalte5 AND

t1.spalte6 between t2.spalte6 and t2.spalte7

So und wie müsste dieses Statement nun umgebaut werden, damit ich mir anzahl der ergebnisse ausgeben lasse?

Genau so wird's gemacht. Würdest Du count noch mit anderen Spalten verwenden, müssten die anderen Spalten ins GROUP BY wandern und Du würdest die Anzahl auf Gruppenebene bekommen.

Dim

EDIT: Das war bezogen auf den Beitrag von Nathalia.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.