How can I query this in SQL?

SELECT s2.id, s2.name, substring(s2.name, 16, 5) AS Standortgruppe FROM setnames AS s2 WHERE s2.name LIKE '%Standortgruppe%' AND ( SELECT Standortgruppe FROM setnames AS s2 INNER JOIN cashpoints AS cp ON Standortgruppe = cp.location )

So I would like the value that comes from the location group to be compared again with the values ​​from cashpoints, location.

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
4 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
1Rainii
1 year ago
SELECT s2.id, 
       s2.name, 
       SUBSTRING(s2.name, 16, 5) AS Standortgruppe 
FROM setnames s2 
WHERE s2.name LIKE '%Standortgruppe%' 
  AND EXISTS (SELECT 1 
              FROM cashpoints cp 
              WHERE s2.Standortgruppe = cp.location);
ZaoDaDong
1 year ago
select s2.id, s2.name, substring(s2.name, 16, 5) as Standortgruppe
 from setnames s2
 join cashpoints cp on cp.location = substring(s2.name, 16, 5)
 where s2.namelike
 '%Standortgruppe%'