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 :: mysql id reset 
Sql :: mysql create database charset utf8mb4 
Sql :: how to see logical reads in sql server 
Sql :: jooq convert using gbk 
Sql :: postgres remove foreign key constraint 
Sql :: mysql get count of rows 
Sql :: mysql return text after a final full stop 
Sql :: sql set auto increment back to 0 
Sql :: mysql show table column full description 
Sql ::  
Sql :: Disabling foreign key checks while performing Sqlalchemy Upgrade 
Sql ::  
Sql :: grant all privileges mysql 8.0.21 
Sql :: postgresql division count return 0 
Sql :: oracle character index 
Sql :: mssql get all table names 
Sql :: mysql show data from table 
Sql :: group by 15 minute interval sql server 
:: mysql substract count and distinct count 
::  
::  
Sql :: sql insert query 
Sql ::  
Sql ::  
Sql :: MSSQL SYNTAX PROCEDURE FUNCTION TRIGGER 
Sql :: using distinct count in sqlite3 
Sql :: what is mysql_pconnect 
Sql :: possgress drop if exists view 
Sql :: like sql 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =