Search
 
SCRIPT & CODE EXAMPLE
 

SQL

select item.* as json mysql

-- You can't use * in json selects in all version of mySQL, but you can 
-- outline all fields you want in a select statement as follows: 
SELECT contact.*, JSON_OBJECT(
  'name_field', name_field,
  'address_field', address_field,
  'contact_age', contact_age
) AS location
FROM contact
JOIN location on contact.loc_id = location.id;

-- You may be able to use "JSON_ARRAYAGG()" for this in mySQL 8+
Comment

how select a json value in mysql

SELECT * FROM table WHERE JSON_CONTAINS(name, '["key"]');
Comment

PREVIOUS NEXT
Code Example
Sql :: how to check database username and password in postgresql 
Sql :: oracle user tables 
Sql :: show sqlite column names 
Sql :: mysql delete binlog 
Sql :: set statiscis on in ssms 
Sql :: restart identity cascade 
Sql :: create table mysql query 
Sql :: delete triger pl pg sql 
Sql :: django sqllite config 
Sql :: sql where last 12 months 
Sql :: mysql bidirectional composite primary key 
Sql :: oracle kill session by sql_id 
Sql :: mysql reset auto increment 
Sql :: set boolean flasksql 
Sql :: mysql full outer join java 
Sql :: sql output inserted id 
Sql :: Are NULL values in a database the same as that of blank space or zero? 
Sql :: mssql get running queries 
Sql :: sql get guid 
Sql :: how to delete a column in sql 
Sql :: sql update from select 
Sql :: show all users in mysql 
Sql :: copy one column data to another in sql 
Sql :: Oracle NLS_CHARACTERSET 
Sql :: oracle create program if not exists 
Sql :: oracle sql timestamp 
Sql :: ms sql truncate table vs delete 
Sql :: oracle sql create view 
Sql :: postgresql insert select 
Sql :: sql show tables 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =