Yes i want all columns from invoice table,
You query has no limiting criteria on either the invoice or customer table which means that the best you can do is return the entire invoice table and maybe get an index scan out of the customer table. There's basically no way to improve the query for performance if you already have an index on the CustomerNo with "includes" on the first and last names all from the customer table. If you don't already have such an index, adding one will likely provide only a relatively small improvement.
Opening a new thread probably won't change those facts. 😉
is pronounced "ree-bar
" and is a "Modenism
" for R
ow.First step towards the paradigm shift of writing Set Based code:________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
"Change is inevitable... change for the better is not".
"Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"
Helpful Links:How to post code problemsHow to Post Performance ProblemsCreate a Tally Function (fnTally)