MySQL get all users who was in work in exact week

I have 2 tables: users and users_arrivals, I need to create a list of users who was in work in specific ranges of dates. Users table looks like: | id | firstName | lastName | | — | ——— | ——– | | 1 | John 1 | Test 1 | | 2 | John… Read More MySQL get all users who was in work in exact week

Why netbenas cannot connect to mysql?

I have a mysql database called employee. I want to connect to this database using netbeans. I get the following exception: ava.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Failed to parse the host:port pair ‘localhost:3306:employee’. My code is: try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } try { String dbURL… Read More Why netbenas cannot connect to mysql?

stop updating column value when status is settled for similar lead id using PHP, MYSQL

i have a following mysql table, where multiple user has accepted a lead (lead_id). here i want to stop updating table column ‘Value’ when ‘status’ is ‘settled <?php $sql = "SELECT `status`,`email_id` FROM `deal_request` WHERE `client_id` = ‘$client_id’"; $query = mysqli_query($connection, $sql); if ($query->num_rows > 0) { while ($row = mysqli_fetch_assoc($query)) { $status = $row[‘status’];… Read More stop updating column value when status is settled for similar lead id using PHP, MYSQL

Using MySQL variable in PHP Prepared Statement

When using a SET clause in a MySQL statement, mysqli->prepare returns false. This MySQL statement will "prepare" okay: $query = " INSERT INTO log (channel, message, context, datetime) VALUES (?, ‘testmsg’, ‘{}’, CURRENT_TIMESTAMP); "; $stmt = $mysqli->prepare($query); // $stmt will be true This statement will cause "prepare" to return false. $query = " SET @Channel… Read More Using MySQL variable in PHP Prepared Statement

MySQL – compare 2 tables and update the 2nd from the 1st

I have 2 tables that I’m importing from CSV files, companies (8000 records) and contacts (11000 records). The contacts have company names which match the names in the company table. After I’ve inserted the records I need to add the companyID to the contacts table. a_test_company +—————+—————+ | companyID | companyName | +—————+—————+ | 1… Read More MySQL – compare 2 tables and update the 2nd from the 1st

MySQL Add string "T" for when there are ties using RANK

I have the following mysql query which works as expected. SELECT DISTINCT u.id, CASE WHEN a.result IS NULL THEN 0 ELSE a.result END ‘result’, RANK() OVER(ORDER BY result DESC) as ‘rank’ FROM wp_users u, wp_usermeta um, (SELECT pm.meta_value, COUNT(*) result FROM wp_postmeta pm, wp_posts p where p.id = pm.post_id and p.post_status = ‘publish’ and pm.meta_key… Read More MySQL Add string "T" for when there are ties using RANK