如何从两个不同的表中获取数据 [英] How to fetch data from two different tables

查看:282
本文介绍了如何从两个不同的表中获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。



实际上,我有两张桌子 Student_info 标记数据库 SMS .....在表 Student_Info 中有一些列,例如 first_name,last_name,branch和unique_identity ...... ....在 Marks 表格中有 10th,12th,BE_aggregate和unique_identity 这样的列,这两列在表格中很常见



现在我想添加一个过滤器,它使用表 Marks中的 10th,12th,BE_aggregate 等值对其执行排序操作分支 Student_Info



我只想显示 dataGridView 中满足上述条件的那些候选人的last_name





所以请为此提供我编码和必需的 SQL查询

Hello Everyone

Actually I am having two tables "Student_info" and "Marks" in my Database "SMS".....In table"Student_Info" there are columns such as first_name, last_name ,branch and unique_identity.......and in Marks table there are columns such as 10th,12th, BE_aggregate and unique_identity which is common in both the table

Now i want add a filter which perform sorting operation on the by using the value such as 10th,12th,BE_aggregate from table Marks and branch from the table Student_Info

and I only want to show the last_name of those candidate who satisfy the above criteria in dataGridView


so for this please provide me coding and required SQL querries

推荐答案

不要直接询问代码/查询和东西。请参阅下面的答案。



您正在谈论的问题,当然可以使用 SQL连接来解决

根据 W3C [ ^ ]:

SQL
Don't ask directly for code/query and stuff. See my answer below.

The problem you're talking about, can certainly be solved using SQL Joins
As per W3C [^]:
SQL
引用:

joins用于组合来自两个或多个表的行。

joins are used to combine rows from two or more tables.



请参阅此处的示例: http://beginner-sql-tutorial.com/sql-joins.htm [ ^ ]。



现在从中获取基本想法并解决您的问题。 :)



-KR


See the example over here : http://beginner-sql-tutorial.com/sql-joins.htm[^].

Now get the basic idea from this and get your problem solved. :)

-KR


这篇关于如何从两个不同的表中获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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