Anquaser Anquaser - 16 days ago 6
MySQL Question

Query INNER JOIN and SELECT

I'm working on a search query, with the use of

LIKE
. However, I'm a bit stuck, mainly logical. I have this query now:

SELECT *
FROM adressen
WHERE CONCAT(adressen.ad_name, adressen.ad_vorname) LIKE
'%"+wndHauptfenster.textfield_suche.Text+"%'


However, I need to get some information from another table, but only from the specific ID which can be used from
adressen.id
. Is it possible to get
fahrzeugen.kennzeichen
with a
WHERE owner_id = adressen.id
?

I thought about an Inner join, however I don't know how I can build in a WHERE there. Is this possible or not?

I couldn't find any answer which solved my question. There is no relationship existent between those Tables. The table Adressen contains the Columns ad_id, ad_name, ad_vorname and ad_adresse. The table where he needs to get the fahrzeugen.kennzeichen of, is called fahrzeugen, and contains an ID, owner_id, and kennzeichen.

Dom Dom
Answer

Like this you mean?

SELECT *
FROM adressen AS A
INNER JOIN fahrzeugen AS F ON F.owner_id = A.id
WHERE CONCAT(A.ad_name, A.ad_vorname) LIKE
          '%"+wndHauptfenster.textfield_suche.Text+"%'
Comments