question

sasasasa avatar image
sasasasa asked

find greater number between two numbers in t-sql.

I have a select statement SELECT C.CustomerID, D.DispatchNumber FROM tblCustomer C LEFT JOIN tblDispatch D ON C.CustomerID = D.CustomerID WHERE D.DispatchNumber (is bigger) I don't know what to write in the statement to get the bigger dispatch number to show with customer ID because there are repetitions for dispatch number for a particular customer. I don't need the Max(DispatchNumber) because it gives me the highest of all the dispatch numbers. How can I get the highest of the dispatch number for a customer. My Dispatch table looks like: CustomerID DispatchID ---------- 1 1 ---------- 1 2 ---------- 2 1 ---------- 2 2 ---------- 2 3 ---------- 3 1
t-sql
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.