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.

SQL abfrage

Empfohlene Antworten

Veröffentlicht

Hallo freunde,

ich habe ein problem den ich selber nicht lösen konnte,

es geht um eine DB tabelle,

Tabelle hat ein user und ein IP spalte.

manche user haben die selbe IP ich möchte abfragen welche user die gleiche IP benutzen.

danke im voraus.

:)

Select ip, user from tabelle

group by ip;

Ein order by kannst du auch noch hinzufügen, um die user in alphabetischer Reihenfolge zu bekommen.

mfg

Belzedar

ich möchte abfragen welche user die gleiche IP benutzen.

nicht die gesammte tabelle ausgeben.

nur die user die gleiche ip haben

beispiel tabelle.

user1 =3

user2 =5

user3 =3

user4 =6

user5 =7

user1 = 8

user4 = 11

user8 = 7

user6= 9

user7=10

deine abfrage gibt alles aus.

ich möchte nur user die eine ip teilen, welcher user haben die gleiche ip

user1 =3

user3 =3

user5 =7

user8 =7

Bearbeitet von dayiabi

ich möchte abfragen welche user die gleiche IP benutzen.

nicht die gesammte tabelle ausgeben.

....

nur die user die gleiche ip haben

Hallo,



SELECT a.benutzer, a.ip

  FROM test a

 WHERE (SELECT COUNT (b.ip) AS countip

          FROM test b

         WHERE a.ip = b.ip) > 1



Gruss

wofür steht a und b :(

funktioniert leider nicht test stehr für tabelle oder ?

funktioniert leider nicht test steht für tabelle oder ?

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /srv/www/web15....

SELECT a.user, a.ip

FROM tabelle a

WHERE (SELECT COUNT (b.ip) AS countip

FROM tabelle b

WHERE a.ip = b.ip) > 1

ich habe nur eine tabelle,

funktioniert leider nicht test steht für tabelle oder ?

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /srv/www/web15....

SELECT a.user, a.ip

FROM tabelle a

WHERE (SELECT COUNT (b.ip) AS countip

FROM tabelle b

WHERE a.ip = b.ip) > 1

ich habe nur eine tabelle,

- Die Aliase benötigst du, weil du ein Subquery hast, indem dieselbe Tabelle nochmals angesprochen wird.

- Das Beispiel läuft unter Oracle, kenne MySQL nicht wirklich gut

Gruss

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /srv/www/web15....

das ist ne php fehlermeldung und hat erstmal nichts mit der abfrage zu tun.

die abfrage selbst sollte so auch in MySQL funktionieren, hab hier allerdings keine um das zu testen.

poste doch mal den php code.

ich habe das lösung aus einer andere forum.


SELECT DISTINCT uip3.* FROM USERIPS uip3 WHERE uip3.ip IN(  SELECT uip1.IP      FROM USERIPS uip1  LEFT JOIN USERIPS uip2 ON uip1.IP = uip2.IP  WHERE uip1.username != uip2.username)UNION ALL SELECT DISTINCT uip4.* FROM USERIPS uip4 WHERE uip.IP IS NULL




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.