I understand how to get the longest field from one column in oracle as below:
select name from daTable
where length(name) =
(select max(length(name)) from daTable)
But now I have 2 tables: one for car_make which have a column make_description (like Nissan) and the other for car_model which have a column model_description (like Tida). How can I get the longest field: car_make with his appropriate car_model from the 2 different tables?
This is the structure of my tables:
Car_make: id_make , make_description
Car_model: id_model, model description,P_id_make
(where P_id_make in car_model is id_make in car_make)
You could concat the column this way
select a.make_description || ' ' || b.model_description as name
from Car_make a
INNER JOIN Car_model b on a.id_make = b.P_id_make
where length( a.make_description || ' ' || b.model_description ) =
( select max(a.make_description || ' ' || b.model_description)
from Car_make a
INNER JOIN Car_model b on a.id_make = b.P_id_make)