sql查询请重播 [英] sql query please replay
本文介绍了sql查询请重播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在sqlserver中有一个表,使用select命令可以显示两个表
in sqlserver have one table using select command to display two tables
推荐答案
这是受信任的sql它.
从newchart t1中选择t1.accode,t2.acname
t2.id = t1.id上的内部联接newchart t2
请检查.
this is trusted sql it.
select t1.accode,t2.acname from newchart t1
inner join newchart t2 on t2.id=t1.id
plz check this.
表不使用选择命令.
Select语句用于从表中检索信息.
如果要从两个单独的表中选择相关数据,则需要学习如何在语句中使用JOIN.我在说的是以下内容.
A table does not use a select command.
Select statements are used to retrieve information from tables.
If you want to select related data from two separate tables then you need to learn how to use a JOIN in your statement. Something like the following is what I am talking about.
select table1.id,
table1.value,
table1.table2_fk,
table2.value
from table1
inner join table2 on table2.id = table1.table2_fk
您应该了解SQL Server中的联接概念
看一下给定的文章,它将使您学习所有类型的Join
http://dotnetslackers.com/articles/sql/SQL-SERVER-JOINs.aspx [ ^ ]
W3Schools- [SQL Join] [
You should learn about Join Concept in SQL Server
Take a look at given article which will enable you to learn all type of Join
http://dotnetslackers.com/articles/sql/SQL-SERVER-JOINs.aspx[^]
W3Schools-[SQL Join][^]
这篇关于sql查询请重播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文