So i currently got 3 tables in my database, One containing information about members, one about their boats (length) and one about prices.
Lid (Member)
Schip (Boat)
Tarief (Prices)
I need to create a query that combines parts of these tables, but i have not found any way how to do this. This is what my 'new' table / select statement result should look like:
I hademade an example for how it should look like if the query works completely:
If anyone knows how to create a query for this or a view and would like to help me, thanks!
Try this:
SELECT l.Naam, l.Adres, l.Email,
(SELECT Bedrag FROM Tarief WHERE Soort = 'contributie' LIMIT 1) AS 'Contributie',
(SELECT Bedrag FROM Tarief WHERE Soort = 'liggeld' LIMIT 1)*IFNULL(s.length,0) AS 'Liggeld',
(SELECT Bedrag FROM Tarief WHERE Soort = 'contributie' LIMIT 1)+
(SELECT Bedrag FROM Tarief WHERE Soort = 'liggeld' LIMIT 1)*IFNULL(s.length,0) AS 'Totaal'
FROM Lid l
LEFT JOIN Schip s ON l.Schip=s.Naam
WHERE l.ContributieBetaald <> 'ja';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.