most efficient way to create query...
-
I am trying to figure out the most efficient way to obtain and present a set of information.... I have a SQL table with information that is related to account numbers. There can be multiple lines with the same account number. I have a list of account numbers in a spreadsheet (about 100). I would like to know if there is at least one record in the table whose account number matches the number on the spreadsheet. Is there ane efficient way to give me a yes/no or other info without hitting the database 100 times? It could be done in Excel or VS2005. Does anyone want to throw out a suggestion? Much thanks in advance.
-
I am trying to figure out the most efficient way to obtain and present a set of information.... I have a SQL table with information that is related to account numbers. There can be multiple lines with the same account number. I have a list of account numbers in a spreadsheet (about 100). I would like to know if there is at least one record in the table whose account number matches the number on the spreadsheet. Is there ane efficient way to give me a yes/no or other info without hitting the database 100 times? It could be done in Excel or VS2005. Does anyone want to throw out a suggestion? Much thanks in advance.
select count( accountnumber ) from table where accountnumber in ( a, b, c )
That will tell you the number of accounts that match, where a, b and c (and so on) are account numbers.
The StartPage Randomizer | The Timelapse Project | A Random Web Page
-
select count( accountnumber ) from table where accountnumber in ( a, b, c )
That will tell you the number of accounts that match, where a, b and c (and so on) are account numbers.
The StartPage Randomizer | The Timelapse Project | A Random Web Page
-
This would give me the number of accounts that match, but not which of the accounts match....correct? I am needing to figure out which of the numbers match. Thanks.
select distinct accountnumber from table where accountnumber in ( a, b, c )
The StartPage Randomizer | The Timelapse Project | A Random Web Page