Convert Sql To Javascript