私は次のようなテーブル構造を持っています:
user_id | first_name | last_name
1 | John | Smith
2 | Mary | Jones
3 | Sang He | Lau
// here is a sample of the code I currently have to do a user search
public List<string> getResults(string autocompleteQuery) {
string[] tokens = autocompleteQuery.Split(' ');
// token[0] = first name parameter (@firstName)
// token[1] = last name parameter (@lastName)
// code here executes the following query:
// SELECT * FROM [user] WHERE first_name = @firstName AND last_name = @lastName
}
ここでの問題は、user_id = 3.
このケースを処理するためにコードまたはクエリをエレガントにアップグレードするにはどうすればよいですか? ありがとう。