select user_id
from tbl
where entity_id in (24, 25)
group by user_id
having count(distinct entity_id) = 2;
The error (2002) Can't connect to ... normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service.https://dev.mysql.com/doc/refman/8.0/en/can-not-co...
не понятно, какой влияние оказывает третья таблица на вторуюНапрямую никакого. У вас INNER JOIN `wp_company_rates` и `wp_term_relationships`, поэтому естественно, что в финальную выборку попадут только те строки, которые совмещаются по условию JOIN'a. Если после RIGHT JOIN вы получили в объединённой строке `wp_company_rates`.`post_id` равное NULL, то, естественно, в INNER JOIN эта строка не войдёт.
import mysql.connector
conn = mysql.connector.connect(host='127.0.0.1', database='test', user='user', password='')
cursor = conn.cursor()
sql = "UPDATE `user` SET `participate`=%s WHERE `id` = %s"
cursor.execute(sql, [number, id])
conn.commit()