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.

Distinct Problem

Empfohlene Antworten

Veröffentlicht

Hallo ich hab folgendes problem, ich hab eine Tabelle bzw. eine Select tabelle, in der alle spalten der tabelle1 + 2 spalten einer tabell2 gejoined werden. Als ergebnis bekomme ich zum teil datensätze, wo sich keine attribute voneinander unterscheiden, also viele gleiche datensätze, diese möchte ich mit distinct aussortieren, ich möchste also das distinct auf 2-3 attribute anwenden, aber die andern spalten weiterhin selecten, nur wie kann ich das trennen? Also der select sieht in etwas so aus:

SELECT

t1.*,t2.spalte1,t2.spalte2

...

So der distinct soll dann so aussehen:

SELECT

DISTINCT t1.spalte2, t1.spalte3 (t1.*,t2.spalte1,t2.spalte2)

--> so wie bekomm ich das in der klammer jetzt dazu? weil wenn ich das dazu schreib, dann wärn das ja auch attribute für das distinct.

Um nochmal klar zumachen was ich eigentlich will, also eine ausgabe sieht so aus:

t1.s1__t1.s2__t1.s3__t1.s4__t1.s5__t2.s1__t2.s1

----------------------------------------------------------------

1234__7236__test___blubb__213___23____XYZ

1234__7236__test___blubb__213___23____XYZ

1234__7236__test___blubb__213___23____XYZ

1234__7236__test___blubb__213___23____XYZ

1234__7236__test___blubb__213___23____XYZ

1234__7236__test___blubb__213___23____XYZ

2367__3672__test___blubb__234___23____GBH

2367__3672__test___blubb__234___23____GBH

2367__3672__test___blubb__234___23____GBH

2367__3672__test___blubb__234___23____GBH

2367__3672__test___blubb__234___23____GBH

Also Ausgabe möchte ich:

t1.s1__t1.s2__t1.s3__t1.s4__t1.s5__t2.s1__t2.s1

----------------------------------------------------------------

1234__7236__test___blubb__213___23____XYZ

2367__3672__test___blubb__234___23____GBH

Versteh ich nicht so ganz. Einfach ein SELECT DISTINCT und dann die Spaltennamen dahinter. Das ergiebt das Ergebnis so wie Du es beschrieben hast.

Die Anwendung von DISTINCT auf einzelne Spalte ist nicht möglich - alles oder nichts. Es gibt noch GROUP BY, allerdings müssen Spalten die nicht im GROUP BY auftauchen in eine Aggregatsfunktion gesteckt werden.

Dim

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.