i have the table customer with column Name varchar(20), adresse varchar(50), tel varchar(10), etc.
how can i select the longest adresse ?
SELECT FROM customer
WHERE adresse ?
i have the table customer with column Name varchar(20), adresse varchar(50), tel varchar(10), etc.
how can i select the longest adresse ?
SELECT FROM customer
WHERE adresse ?
select top (1) * from customer order by len(adresse) desc;
You can do it with a subquery:
select * from customer where len (adresse) = (
select max (len (adresse)) from customer)
The inner query figures out the maximum length over all the adresse
columns, and the outer query gives you all the rows that have that length. And it may be more than one.
SELECT address FROM customer WHERE length(address) = (SELECT max(length(address)) FROM customer)
try this:
select max(len(adresse)) from customer