对sqlserver加入主题的疑惑 [英] doubts on sqlserver joins topic

查看:105
本文介绍了对sqlserver加入主题的疑惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sir / mam

i我是一个学习者我怀疑是什么?b $ bi在我的数据库中有30个表,并且在所有30个表中都有点击(列名)。 />
我的要求是从所有30个表中获取最后插入的记录。



i有我的table1中的id,news,clicks columns

就像我有30个表所有表的列名点击是相同的,我需要从所有30个表中获得最高点击次数

希望你理解

提前谢谢。

sir/mam
i am a learner i have a doubt that is
i have a 30 tables in my database and clicks(columnname) in all 30 tables.
and my requirement is to get the last inserted records from all 30 tables.

i have id,news,clicks columns in my table1
like that i have 30 tables column name clicks is same for all the tables and i need to get the top clicks from all 30 tables
Hope you understand
Thanks in advance.

推荐答案

raxhemanth写道:
raxhemanth wrote:

我有30张桌子在我的数据库中,并在所有30个表中单击(列名)。

我的要求是从所有30个表中获取最后插入的记录。

i have a 30 tables in my database and clicks(columnname) in all 30 tables.
and my requirement is to get the last inserted records from all 30 tables.

要获取最后一条记录,请检查此答案

Sql Query选择最后一行表 [ ^ ]

使用 UNION ALL [ ^ ]你可以从30个表中获得30条记录。

To get last record, check this answer
Sql Query to select last Row of The Table[^]
Using UNION ALL[^] you could get 30 records from 30 tables.

raxhemanth写道:
raxhemanth wrote:

我有id,新闻,点击我的table1中的列

就像我有30个表列名称点击是相同的所有表,我需要得到来自所有30个表的热门点击

i have id,news,clicks columns in my table1
like that i have 30 tables column name clicks is same for all the tables and i need to get the top clicks from all 30 tables

如果您的意思是列值,那么您可以使用 MAX [ ^ ]功能。如前面的回复中所述,您可以使用 UNION ALL 从所有表中获取数据。

If you mean column value then you could use MAX[^] function. As stated in previous reply you could use UNION ALL to get data from all tables.


这篇关于对sqlserver加入主题的疑惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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