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.

Probleme bei der Stringverkettung

Empfohlene Antworten

Veröffentlicht

hi,

Ich habe ein Problem bei einer Suche innerhalt einer Tabelle und zwar:

Die Tabelle beinhaltet die Spalten ID, Name, Vorname und Password,

nun möchte ich speziell nach einer Person suchen; sprich Name und Vorname nach einer Mask durchsuchen

Ich hatte mir folgendes überlegt:


SELECT * FROM tab_person p

WHERE p.Vorname+' '+p.Name like '%mann%'

In der Tabelle ist ein Datensatz mit Max Mustermann angelegt.

Theoretisch müsste das ja gehen weil Max+' '+Mustermann ist ja wie (like) der Wildcardstring %mann%

Aber warum auch immer, wird er mir nicht angezeigt.

Weis jemand warum?

Version:

MySQL 5.0.13


SELECT * FROM tab_person p

WHERE CONCAT(Vorname,Name) like '%mann%'

Die Leerstelle brauchst du ja nicht, ginge aberso:

CONCAT(Vorname,' ', Name)

wenn du sie dennoch haben willst

EDIT:

Das + addiert die Werte, und gibt keinen String zurück, den du vergleichen kannst (sollte sogar nen Fehler bringen, würde ich sagen).

Concat ist ein SQL bestandteil, wie Select ;) Auch Oracle beherrscht das

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.