Find two array/json are equal or not ?

if you try this

var a = [1,2,3];
var b = [1,2,3];
if(a == b)//return false

To find two ARRAY/JSON equal or not first convert array/json to string and apply condition

var a = [1,2,3];
var b = [1,2,3];
if( JSON.stringify(a) == JSON.stringify(b) )//return True

Here “JSON.stringify(array/json)” does the magic…( convert array/json to string )

Insert Multiple Row using SQL – NEW

INSERT INTO TableName (FieldName1,FieldName2,FieldName3)
SELECT '235', 'Black', 'black.jpg'
UNION ALL
SELECT '457', 'Charcoal', 'charcoal.jpg' 
UNION ALL
SELECT '235', 'Khaki', 'khaki.jpg' 
UNION ALL
SELECT '689', 'Navy', 'navy.jpg' 
UNION ALL
SELECT '568', 'OD Green', 'odgreen.jpg';

Select record has highest “Date”(any field)

You can select record corresponding to its highest value in any field

SELECT * FROM tableName where fieldName = (SELECT MAX( fieldName ) FROM tableName)

Here,

SELECT MAX( fieldName ) FROM tableName

Get the Highest in fieldName. It can be number or date(In this “2014-02-30 12:20:12” format).

MAX( fieldName ), does the Magic….;)

Download JSON as CSV file

Download a JSON in CSV file

var data = [["name1", "city1", "some other info"], ["name2", "city2", "more info"]];
var csvContent = "data:text/csv;charset=utf-8,";
data.forEach(function(infoArray, index){

   dataString = infoArray.join(",");
   csvContent += index < infoArray.length ? dataString+ "\n" : dataString;

}); 

var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", "my_data.csv");

link.click(); // This will download the data file named "my_data.csv".