如何在Access中显示特定行 [英] How to display specific row in Access
本文介绍了如何在Access中显示特定行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有一个带有主键"ID"的表,然后我在列中有其他数据,(比如说:名称,地址,电话号码),如何进行查询以显示名称,地址和PhoneNum(整行)是否垂直显示特定ID?
If I have a table with a Primary key 'ID', and then I have other data in columns, (let's just say for example: Name, Address, PhoneNum) how can I make a query so that it displays the Name, Address and PhoneNum (the whole row) vertically for a specific ID?
如果需要,我可以贴一张图片来解释我的意思.
If needed I can post a picture trying to explain what I mean.
谢谢! :)
推荐答案
对于名为[Clients]的表中的示例数据
For my sample data in a table called [Clients]
ID LastName FirstName Email
-- -------- --------- -----
1 Thompson Gord gord@example.com
2 Loblaw Bob bob@example.com
3 Kingsley Hank hank@example.com
查询
SELECT "LastName" AS fld, LastName AS val FROM Clients WHERE ID=1
UNION ALL
SELECT "FirstName" AS fld, FirstName AS val FROM Clients WHERE ID=1
UNION ALL
SELECT "Email" AS fld, Email AS val FROM Clients WHERE ID=1;
返回
fld val
--- ---
LastName Thompson
FirstName Gord
Email gord@example.com
这篇关于如何在Access中显示特定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文