如何连接两个表并匹配相同的值并显示 [英] how to connect two tables and match the same value and display

查看:73
本文介绍了如何连接两个表并匹配相同的值并显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表注册,其中用户名是一列,第二个是我的结果作为我的表,而total作为我的column.尽快我注册了我自己,它存储在注册表中,当我运行该应用程序时有一些值存储在结果表中.存储用户名时,同时将总数列存储在结果表中.

现在我想显示输入用户名的结果.

如果我输入用户名,则该用户的特定值应与结果表中的该特定行匹配.一旦我找到应与结果表的行相匹配的用户名的行.
我需要使用什么查询.

是一些外部联接吗?
请给我查询.

i have two tables registration in which username is one column and second i have result as my table and total as my column.as soon i register myself it gets stored in registration table and some value when i run the application ,that gets stored in result table.when the username is stored ,simultaneoussly the total column is stored in result table.

now i want to display the result of the entered username.

if i enter the username the particular value of that user should match with that particular row in result table.once i find the row of the username that should match with the row of result table.
what query i need to use.

is it some outer join.
plz give me the query.

推荐答案

SELECT * from result
FULL OUTER JOIN  registration
ON registration.ID = result.registrationID 
WHERE registration.username='"+TextBox1.Text+"'


U have to maintain the "userid" column in both table.


U have to maintain the "userid" column in both table.


select * from registation t1,result t2 where t1.username='"+TextBox1.Text+"'  and t1.userid=t2.userid


这篇关于如何连接两个表并匹配相同的值并显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆