mysqlunion多张表_mysql–使⽤UNION在多个表中进⾏选择我将我的数据库从⼀个⽤户表重新编写为多个⽤户表(按⾓⾊划分):tblStudents,tblTeachers,tblAdmin
登录时,我不想运⾏三个查询来检查⽤户是否存在于我的数据库中的某个位置.所以我所做的是将以下查询与union放在⼀起
select s.id as id, s.email as email, s.password as password, s.role as role from tblStudents s
matlab画图标注曲线名字union
数据库中查看表结构命令select a.id as id, a.email as email, a.password as password, a.role as role from tblAdmin a
union
select t.id as id, t.email as email, t.password as password, t.role as role from tblTeachers t
这将选择所有表中相同的字段,并为我输出结果.
mysql语句多表查询所以,我决定尝试这个,出于某种原因,我的登录表单不起作⽤.对于我的登录表单,我添加了⼀个where⼦句来检查电⼦邮件地址.我在我的数据库应⽤程序中运⾏查询,令⼈惊讶的是,当我执⾏例如em
ail =“admin@admin.be”(此电⼦邮件存在于我的数据库tblAdmin中)时,它还从我的学⽣表中选择⼀条记录.
sping什么意思使⽤where⼦句:
select s.id as id, s.email as email, s.password as password, s.role as role from tblStudents s
union
怎么让div上下左右居中select a.id as id, a.email as email, a.password as password, a.role as role from tblAdmin a
union
select t.id as id, t.email as email, t.password as password, t.role as role from tblTeachers t
where email = "admin@admin.be"
正则匹配最后一个字符记录都有id = 1,但我不明⽩为什么当我在管理员电⼦邮件地址上过滤时会选择学⽣记录.为什么是这样?有⼈可以解释并为我提供更好的解决⽅案吗?我基本上有⼀个登录表单,需要跨多个表选择以检查⽤户是否存在于我的数据库中.
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论