如何从两个不同的表中获取日期? [英] How to fetch dates from two different tables?

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

问题描述

我有两个不同的表都有一个共同的字段,即结婚周年日期和明显的'日期'类型。一个是关于丈夫的细节,另一个是关于妻子的详细信息。

有没有办法,以便可以同时或在同一个GridView(在Asp.Net中)从两个表中获取即将到来的周年纪念日...

或者其他一些方法,无论我在这里做什么......

解决方案

这里的问题可能与事实上两个表都有相同的字段名称。



所以你可以使用别名,例如:



 SELECT 
TableA.AnniversaryDate as ' TableADate'
TableB.AnniversaryDate as ' TableBDate'
FROM
TableA join TableB on(TableA.Key = TableB.Key)


I have two different tables both having a common field i.e, Marriage Anniversary date and obviously of 'date' type. One is having details of husband and another having details of wife.
Is there any way, so that the upcoming Anniversaries may be fetched from both tables at same time or in same GridView(in Asp.Net)...
Or some other ways whatever I can do in this....

解决方案

The issue here might be related to the fact that both tables has the same field names.

So you could use aliasing, something like:

SELECT
  TableA.AnniversaryDate as 'TableADate',
  TableB.AnniversaryDate as 'TableBDate',
FROM
  TableA join TableB on (TableA.Key = TableB.Key)


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

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