I have two tables: baseresulttables and historyviewdemands. I want to get the first n entries from baseresulttables, and if there are values for them in historyviewdemands. But the query works like an inner join. What am I doing wrong? baseresulttables historyviewdemands Query: reuslt Answer Using LIMIT witho…
Tag: mysql
How to select combination of 4 digits number from table columns?
I have a table as below:- id | columnA | columnB | columnC 1 7234 3432 3245 2 1237 1123 6546 3 4421 9371 7324 4 1244 1424 4237 How can I select …
how to get single result in using 2 table data
i have to table 2 in same structure .i already get the result by using one table using following query this query will time devide in to the 2 part(time in and time out) .it work fine.now want to get the data from anther table also.it also have same structure attendancedata table. attendancedata table structu…
i can’t Merge two tables
i have one tables attendance main table i created 2 views from attendance table attend view and leaved view view:attend view:leaved after that i used this code to merge attend and leaved view the result was like this result i need each employee has attend time and leaved time in same day Answer This following…
MYSQL: Insert with Select not working properly
I can’t seem to debug this issue. I am currently running to set person_id to -1, but also utilize a select statement with this person_id value. Using this statement, I cannot find any reason online …
Find duplicate email and copy value from one row and insert it another row with same emails in MySQL
i have user table which has four columns(id , email ,phone , status ) . i trying to copy phone number from one row by email and insert it in another row with same duplicate email where status is 1. …
Query table using multiple foreign keys
So I’m just messing around with a NodeJS application, and I’m trying to implement a permission system using my database. It’s my first time working with any kind of SQL environment, so please correct me if I’m doing something terribly wrong. I have the following tables: So there are 2 …
MYSQL – How to check if a column has value or is it null and another column has value like 10
Lets say i have a table with 3 columns id, user and status. I need to find rows which have status as 1 or null and user = ‘someName’ I am lookin for a condition like this: if (user == ‘name’ && status == 1 || status == null) How do i do this in mysql Answer Just: This can
error when I try to activate my code navicat 12
I have an error when I try to activate my code. and I do not know what’s the solution. This is my error : error navicat I had already followed youtube videos to activate navicat 12 and I managed …
MySQL – removal of duplicate results in JSON_ARRAYAGG in the presence of GROUP BY
I have query: The result of this query duplicates the same image urls in column urlLinks: How can I leave as a result only unique image urls? GROUP BY cannot be removed from the request!!! Answer JSON_ARRAYAGG() does not support DISTINCT. You can SELECT DISTINCT in a subquery, and then aggregate: Demo on DB F…