同一张表存在类似多级菜单的上下级关系的数据,查询出符合条件的某些数据的id拼接成一个字段返回: SELECT CONCAT(a.pid, ',', b.subid) AS studentIDS FROM (SELECT id as pid, sourceCode as scode FROM student WHERE studentType='父级条件1' AND studentCode='父级条件2') a LEFT JOIN (SELECT id as subid, parentCode p
查询分为关键字查询和准确查询 1.没有提交的时候--查所有 2.两个输入都为空--查所有3.第一个条件有,第二个为空--根据第一个条件查4.第一个没有,第二个有--根据第二个条件查5.两个都有--根据两个条件查 where name like '%宋%' and 1=1where 1=1 and nation='n001' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www