Table Variable result set ???
-
I have filled a table variable with some invoice data and it looks like this: Invoice# Batch# 733F7F75 946 733F7F75 924 733F7F75 929 733F7F75 940 733F7F75 948 733F7F75 939 733F7F75 947 733F7F75 923 733F7F75 938 733F7F75 922 733F7F75 927 733F7F75 944 733F7F75 945 I have a basic select query on that temp table, something like this: select InvoiceNumber, BatchNumber from @t order by InvoiceNumber what can I do to get the highest batchNumber (Underlined result up there ^) from my table variable?
-
I have filled a table variable with some invoice data and it looks like this: Invoice# Batch# 733F7F75 946 733F7F75 924 733F7F75 929 733F7F75 940 733F7F75 948 733F7F75 939 733F7F75 947 733F7F75 923 733F7F75 938 733F7F75 922 733F7F75 927 733F7F75 944 733F7F75 945 I have a basic select query on that temp table, something like this: select InvoiceNumber, BatchNumber from @t order by InvoiceNumber what can I do to get the highest batchNumber (Underlined result up there ^) from my table variable?
-
I have filled a table variable with some invoice data and it looks like this: Invoice# Batch# 733F7F75 946 733F7F75 924 733F7F75 929 733F7F75 940 733F7F75 948 733F7F75 939 733F7F75 947 733F7F75 923 733F7F75 938 733F7F75 922 733F7F75 927 733F7F75 944 733F7F75 945 I have a basic select query on that temp table, something like this: select InvoiceNumber, BatchNumber from @t order by InvoiceNumber what can I do to get the highest batchNumber (Underlined result up there ^) from my table variable?
Hi, Use Max function to get the largest number from the table. The syntax is: SELECT MAX(net_amount) FROM Sales; SELECT MAX(company) FROM Sales WHERE net_amount > 100; I hope this would be helpful.
Vinay ComponentOne LLC. www.componentone.com