table group by value bootstrap 3 code example
Example 1: html table filter by all columns
function myFunction() {
var input, filter, table, tr, td, i;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
var rows = table.getElementsByTagName("tr");
for (i = 0; i < rows.length; i++) {
var cells = rows[i].getElementsByTagName("td");
var j;
var rowContainsFilter = false;
for (j = 0; j < cells.length; j++) {
if (cells[j]) {
if (cells[j].innerHTML.toUpperCase().indexOf(filter) > -1) {
rowContainsFilter = true;
continue;
}
}
}
if (! rowContainsFilter) {
rows[i].style.display = "none";
} else {
rows[i].style.display = "";
}
}
}
Example 2: SELECT 1 from table
select * from StudentTable;
-- output :
+------+-------+
| id | name |
+------+-------+
| 1 | John |
| 2 | Carol |
| 3 | Smith |
| 4 | Bob |
+------+-------+
4 rows in set (0.00 sec)
-- EXAMPLE OF SELECT 1
select 1 from StudentTable;
-- output :
+---+
| 1 |
+---+
| 1 |
| 1 |
| 1 |
| 1 |
+---+
4 rows in set (0.00 sec)
-- The above returns 1 four times for 4 records,
-- and if we had 5 records then the above query
-- would have returned 1 five times.