SQL 2005中的嵌套选择查询

编程入门 行业动态 更新时间:2024-10-18 16:43:00
本文介绍了SQL 2005中的嵌套选择查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有两个桌子. 1.管理员(用户名,密码) 2.User(用户名,类型) 我已经提供了用户名和密码,我想从User表中检索用户类型.

I have two table. 1.Admin(username,password) 2.User(username,type) I have given username and password and I want retrieve the type of user from User table.

推荐答案

select type from [User] where username = 'the_username_wanted'

一个简单的连接就是你要的 a simple join is what you are after SELECT * FROM Admin a JOIN User u ON a.username = u.username WHERE a.username = @username AND a.password = @password

关于CP的连接,也有不错的文章此处 [ ^ ]

There is also a good article on CP about joins here[^]

select type from user where username = @username

@username是您必须将其传递给存储过程或sql语句的参数.

@username is a parameter that you have to pass it to stored procedure or sql statement.

更多推荐

SQL 2005中的嵌套选择查询

本文发布于:2023-10-23 05:37:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519951.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:嵌套   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!