//Excuse my english
I want to select the greatest id in my 'client 'table (which has 383 clients, that means 383 it's the largest id), but when I make the query it returns '99'.
func bar<T>() -> [T] {
return [T]()
}
let val1 = bar() as [Int] // or:
let val2 : [Int] = bar()
I don't know what to do. My objective is to add 1 to de latest id to make a new id for a new client.
答案 0 :(得分:5)
Your <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
.wrap-left{
width:66%;
min-height:500px;
display:inline-block;
float:left;
background-color:rgba(0,0,0,0.48);
}
.wrap-right{
width:34%;
background-color:rgba(172, 172, 172, 0.48);
min-height:500px;
display:inline-block;
float:left;
}
.wrap-left .content{
max-width:693px;
width:100%;
height:100%;
float:right;
background-color:transparent;
/*background-color:rgba(0,0,0,0.48);*/
}
.wrap-right .sidebar{
max-width:347px;
width:100%;
height:100%;
float:left;
background-color:transparent;
/*background-color:rgba(172, 172, 172, 0.48);*/
}
.centered-example{
width:100%;
max-width:1040px;
height:200px;
background-color:#000000;
margin:0 auto;
clear:both;
}
.centered-example .content{
width:66%;
height:100%;
float:left;
background-color:rgba(0,0,0,0.48);
}
.centered-example .sidebar{
width:34%;
height:100%;
float:left;
background-color:rgba(172, 172, 172, 0.48);
}
</style>
</head>
<body>
<div class="wrap-left">
<div class="content">
This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.This is the content.
</div>
</div>
<div class="wrap-right">
<div class="sidebar">
This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.This is the sidebar.
</div>
</div>
<div class="centered-example">
<div class="content"></div>
<div class="sidebar"></div>
</div>
</body>
</html>
is being stored as a string (probably).
You can use silent conversion to get the max:
id
Alternatively, use select max(id + 0)
from clients;
and order by
:
limit