In MySQL, puoi usare substring_index()
e aggregazione:
select o.quoteId, o.salesorderid,
max(q.quote_id)
from orders o left join
quotes q
on o.quoteId = substring_index(q.quoteId, '-', 1)
group by o.quoteId;
In SQL Server (o anche MySQL), puoi usare LIKE
per il confronto:
select o.quoteId, o.salesorderid,
max(q.quote_id)
from orders o left join
quotes q
on q.quoteId like concat(o.quoteId, '-%')
group by o.quoteId;