The second time I try to get an answer to my question: The above is the structure of the database I will describe everything in detail: The first table is the alarm, in which there is only id , firma and model . Everything is clear here. Next comes the costusers table - it stores data on the cost of each alarm in different stores, i.e. The id_sign field stores the id from the signalizacii table, signalizacii field is the field that refers to the uc_id field in the uc1 table, and the cost field is the price. Table uc1 is all shops in all cities.
You just need to select all the alarms from the signalizacii table and add another field in which will store the minimum price for a particular city. If suddenly it happens that in the costusers table costusers not a single price for any kind of alarm in a certain city, then you need to output 0.
Help please, I have been fighting for several days with this query ... SQL is not mine ...
Update
select signalizacii.*, COALESCE(MIN(CASE WHEN costusers.cost != 0 THEN costusers.cost END), 0) from signalizacii left join costusers on id_sign = id left join uc1 on costusers.id_user = uc1.user_id where uc1.city = 'Краснодар' group by signalizacii.id That's what I wanted - it seemed to me. But it was not here that if the price for any alarm is not set in the costusers table, then this alarm is not displayed at all.
The problem is still not solved. Please help ... Please. The above result, which I cited, unfortunately does not display an alarm at all if the price for it is not set by any of the stores in the specified city. And it should be displayed but the price should be 0. Help please.

select signalizacii.*, min(cost), city from signalizacii left join costusers on id_sign = id left join uc1 on uc_id = costusers.id_user group by signalizacii.id, signalizacii.firma, signalizacii.model, city- nick_n_aonfor uc1 - Mikenull. - Pyramidhead