clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 818513 fiddles created (9187 in the last week).

CREATE TABLE TableData_400 (id INT, created_date DATETIME, sample_1 TEXT, sample_2 TEXT, sample_3 TEXT, sample_4_1 TINYINT, sample_4_2 TINYINT, sample_4_3 TINYINT ); INSERT INTO TableData_400 VALUES ('1','2019-05-17 06:19:13','aaa', 'bbb','ccc',0,0,1); select * from TableData_400
id created_date sample_1 sample_2 sample_3 sample_4_1 sample_4_2 sample_4_3
1 2019-05-17 06:19:13 aaa bbb ccc 0 0 1
 hidden batch(es)


CREATE TABLE TableData_elements (Dataid INT, sample_id INT, sample_title TEXT ); INSERT INTO TableData_elements VALUES ('400','1','Fname'), ('400','2','Sname'), ('400','3','Lname'), ('400','4','checkbox'); select * from TableData_elements where Dataid=400
Dataid sample_id sample_title
400 1 Fname
400 2 Sname
400 3 Lname
400 4 checkbox
 hidden batch(es)


CREATE TABLE TableData_elements_options (Dataid INT, sample_id INT, option_id INT, optionss TEXT ); INSERT INTO TableData_elements_options VALUES ('400',4,1,'First'), ('400',4,2,'second'), ('400',4,3,'Third'); select * from TableData_elements_options where Dataid=400
Dataid sample_id option_id optionss
400 4 1 First
400 4 2 second
400 4 3 Third
 hidden batch(es)


expected result like select datas from TableData_400 like the following way , id created_date fname Sname Lname first second third 1 2019-05-17 06:19:13 aaa bbb ccc 0 0 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'expected result like select datas from TableData_400 like the following way , ' at line 1
 hidden batch(es)


SELECT CONCAT( 'SELECT ', GROUP_CONCAT(CONCAT('sample_', sample_id, ' ', sample_title)), ' FROM TableData_400' ) INTO @sql FROM TableData_elements; SELECT @sql; PREPARE myStatement FROM @sql; EXECUTE myStatement ; DROP PREPARE myStatement;
@sql
SELECT sample_1 Fname,sample_2 Sname,sample_3 Lname,sample_4 checkbox FROM TableData_400
 hidden batch(es)