Saturday 11 March 2017

Limit each occurrence of a list by 1

I have the following query that prints out a list of numbers. I would like to limit each unique number by 1.

For example if there is three 18 in the database, it will print out 18, 18, 18, and if they are two occurrences of 5, it will print out 5,5. I only it to appear 18, and 5 in this case.

 let sqlSelectBoxInformation = "SELECT longestDimension from box ";

     connectionBoxInformation.query(sqlSelectBoxInformation, function(err, rows, fields) {

    if (!err) {
      // Check to see if the user entered hashtag is found in the database
      // Create a variable to track if the item was found


            var data = {
             rows: rows,
             userHashtag: databaseHashtag
            }
            res.render('delivery/chooseBox', data);

    }



          });



via John

No comments:

Post a Comment