MySQL: How to insert all columns from table to new table and NULL for extra columns not matched?

MySQL
Let me explain I have a MySQL table [Table A] with 89 Columns and 5 Million rows. I have to add 10 new columns(default NULL) to [Table A]. Currently...
1 year ago

Join all columns in a while loop

MySQL
I have this loop: BEGIN DECLARE time INT DEFAULT 1479154801; WHILE time <= 1481756399 DO SELECT time; SELECT COUNT(*) FROM phpbb_posts ...
1 year ago

how to decode std class object

MySQL
i have a json stored in database which looks like this [{"class":"button-input btn btn-warning","name":"gorilla-preview","value":"Goat","id":"gorilla...
1 year ago

Value of where clause in sql query is the parent column of select

MySQL
I have a query like below. As shown it has a subquery. What I want is to make the value of where clause should be base on the s1.id. Currently I make ...
1 year ago

Mysql - Combine two tables with different date value with group by

MySQL
I'm working on project, Where i need to show earned points and exchanged points by user per day. I have two different table to store data. tables(a,...
1 year ago

Method for returning row with mysql that matches both values through a relational join

MySQL
I have data connected over three tables in mysql and I'm looking for a method to return rows that match all values passed to the MYSQL query. For exam...
1 year ago

MySQL select a set of columns with more than one variation in another column

MySQL
table looks like this: id group name 1 1 A 2 1 A 3 2 A 4 2 B 5 3 A I want to select the rows with more than one distinct n...
1 year ago

mysql- insert 0 for records that don't have a value

MySQL
I'm building an application which will list exam related details of a student. CREATE TABLE IF NOT EXISTS `es_student` ( `student_id` int(11) NOT N...
1 year ago

mysql select limit on foreign key

MySQL
I have two tables. Products and products-sub. what I want is to show all the available color for each product and a picture for that too. So, my prod...
1 year ago

So I am trying to get a database up and running with php artisan for Laravel 5.x but I get this error when I check to see if I have mysql running

MySQL
zsh: command not found: mysql I have exhausted the SO forums that provide suggestions and nothing is working and most talk about bash_profile, but t...
1 year ago

MySQL Query for Graphs

MySQL
I've got the following query: SELECT GVA12.FECHA_EMIS, GVA12.COD_VENDED, sum(GVA12.IMPORTE) FROM GVA12 WHERE Month(GVA12.FECHA_EMIS)=Month(curDate())...
1 year ago

Get same named columns seperately after left join in mysql using Eloquent

MySQL
I have 2 tables one of them stores students and the other one managers students have name surname, eventually managers have name and surname too. ...
1 year ago

MySQL: create function that returns an array

MySQL
CREATE Function getNearIds (myLocationLon double, myLocationLat double) RETURNS WHAT I just want to return an array of integers, after a long search:...
1 year ago

How to retrieve the current version of a MySQL database?

MySQL
What command returns the current version of a MySQL database?
1 year ago

Mysql GROUP by a key and pick the higher value

MySQL
I have been trying to group by by a certain key but the only higher value. for example lets say this is my data ID KEY Name Value1...
1 year ago

PHP prepared statement insert from a loop of data

MySQL
Any ideas as to why my data isn't being updated? Is their something fundamentally wrong with how I'm writing my prepared statement? The form: whil...
1 year ago

Get last inserted value from MySQL using SQLAlchemy

MySQL
I've just run across a fairly vexing problem, and after testing I have found that NONE of the available answers are sufficient. I have seen various ...
1 year ago

mysqldump is not dumping any table

MySQL
I can't manage to backup my MySQL database. I use the following command: mysqldump --user=user --password=password db > db.sql This is what the ...
1 year ago

inserting record into mysql table if column count value is 2

MySQL
Below is code for count record for today's date and inserting into database if value is not more than two per day. $user_ip = getenv('REMOTE_ADDR')...
1 year ago

mysql Cannot add 2 Foreign Keys

MySQL
I'm writing a script for an associative table in MySQL and It stops compiling at the second foreign key constraint; does anyone know what could be wro...
1 year ago