Master-slave table to get the data, for example students table, table
Scores on the surface of the table band can be A, B, C, D can also be digital
I need to judge scores & gt; What are the students of 90
How should deal with
Because the score is defined as a string type, so there is something wrong with the match,
Can't through! Have to lambda expressions better at, give some directions!
CodePudding user response:
Q&a: why can't I use integral, can only use the money?
CodePudding user response:
Use linq?
Direct the students table. Any (p=& gt; P. scores & gt; 90). The name
CodePudding user response:
Come all the table structure, not what the ABCD,
CodePudding user response:
refer to the second floor shawn_yang response: use linq? Direct the students table. Any (p=& gt; P. scores & gt; 90). The name Scores are of type string, cannot use & gt; 90 judgment CodePudding user response:
Where (x=& gt; X.Score.Com pareTo (" 90 ") & gt;=0) I do not know if this meets your requirements CodePudding user response:
The simplest example, Students table Student no. Student's name 01 zhang 02 li si Score Student no subject result Chinese 90 01 01 mathematics B 02 Chinese 99 02 math 96 03 language A Result is a string type, I want to result in language & gt; 90 CodePudding user response:
No, that is similar to compare strings are equal, thank you CodePudding user response:
Not directly in SQL CodePudding user response:
refer to the eighth floor Bridge_go response: not use SQL directly? Issue is to write not write compatibility, only temporarily use linq, a bag, ha ha CodePudding user response:
Change result field type, which useful string CodePudding user response:
references to the tenth floor shawn_yang response: change result field type, which has a string of If the deposit is A, B, C, D, ha ha CodePudding user response:
Let's change the database, you how many points does this represent A, should separate scores and AB two columns CodePudding user response:
More than 90, the result is A count CodePudding user response:
Are you sure my way? Might as well try running CodePudding user response:
Int num=0; Var query=the from a db in student table Join in the db. The b grade table On a. student number equals b. Student no. .Where int. TryParse (b. result, out num) & amp; & Num> 90 Select new { Name=a. student's name }; CodePudding user response:
The reference 14 floor hands on the keyboard to knock very light response: are you sure my way? Could try running Not tried CodePudding user response:
Why do you want to convert to an int? Estimated when you perform such complains Int num=0; Var query=the from a db in student table Join in the db. The b grade table On a. student number equals b. Student no. .Where b.. CompareTo (" 90 ") & gt;=0 Select new { Name=a. student's name }; See, because I now are used in this way, as your demand