Home > database >  SQL fuzzy query problem, a fuzzy query conditions of the query result is another.
SQL fuzzy query problem, a fuzzy query conditions of the query result is another.

Time:10-16

Select student. * from student where the student. The course like (select the teacher. The course from the teacher where the teacher. The name='A');
Students' course field is: class name, class name, class name,;
Teacher's curriculum field is: class name;
The above code output is precise query, not I want, can you tell me how to write the fuzzy query should,

CodePudding user response:

refer to the original poster weixin_45740701 response:
select student. * from student where the student. The course like (select the teacher. The course from the teacher where the teacher. The name='A');
Students' course field is: class name, class name, class name,;
Teacher's curriculum field is: class name;
The above code output is precise query, not I want, can you tell me how to write the fuzzy query should,

Please god help me, thank you very much

CodePudding user response:

Select student. * from student where the student. The course like (select N '%' + the teacher. The course + N '%' from the teacher where the teacher. The name='A');

CodePudding user response:

reference no. 2 floor ZJCXC -- personal WeChat public same response:
select student. * from student where the student. The course like (select N '%' + the teacher. The course + N '%' from the teacher where the teacher. The name='A');

Ah, this is wrong,  , think again after the output fuzzy query

CodePudding user response:

Select *
The from student b
Where the exists (select course from the teacher a where clause a.n ame='wsy' and CHARINDEX (ltrim (rtrim (a.c ourse)), the biggest ourse) & gt; 0)
  • Related