Skip to content

Tag: mysql

SQL table.column not working when I use it with full join

I have this SQL query: And it returns the error : “unknown column main.cname in filed list”. while the column certainly exists: seems alright. I tried using aliases but it just made it worse. I’m clueless Answer As coyeb60297 has pointed out, MySQL doesn’t do full outer joins so your q…

SELECT from table with count from another

I have 2 mysql tables I need to get all views by user, but also need to get the user role (for each view) and calculate a dynamic number of users used for every view. So, I need to get all view columns, plus the role of the user which do this request (from ViewUser), plus count of users for

how to query get value without id

I want to get the value of the column regardless of the id of the table, because I want to use GROUP BY to concatenate them from the table : id_child id_master test1 test2 test3 1 1 1 1 0 2 1 1 0 0 3 1 1 0 0 4 2 1 0 0 5 2 1 0 0

How to use INSERT INTO — SELECT with new timestamp?

I’m working on a small website, that keep tracks of students information, When someone makes an update on one of the students I want to archive a copy of the previous record, I know that doing this makes a copy of the current data. But I want to include the date when the edit was made, so I tried this,

MySQL find first row base on multiple conditions

Suppose exists a table as follows: For each id, i want to keep the row with maximum B, if B equals, then keep the row with maximum C. So the final result is, how to realize it by SQL? Answer Maximum tasks can be solved with NOT EXISTS. You only want rows for which not exists a row with the