如何从结果中只获取一条记录... [英] How to fetch only one record from resultt...
本文介绍了如何从结果中只获取一条记录...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在其他3个表上使用连接触发表上的单个查询,我只希望结果中有一行,
3个表中的
一个唯一ID是uead,但是在最后一个表中没有条目那个id,所以我得到了多条记录,我只想要第一条记录,?
在最后一张表和其他表中只有一个id是常见的
提前提前,。 。
I am firing single query on table with joins on other 3 tables , I want only one row in result,
in 3 tables one unique id is uead ,but in last table no of entries for that id , so i get multiple records , i only want first record ,?
There is only one id is common in last table and other table
Thanx in advance ,..
推荐答案
如果您使用的是sqlserver,请使用top 1.如果您使用的是oracle,其中rownum = 1
例如SQL Server:select来自(您的选择查询)别名的前1 *;
例如Oracle:select * from(您的选择查询)别名alias.rownum = 1;
Use top 1, if you are using sqlserver.If you are using oracle where rownum=1
eg SQL Server: select top 1 * from (your select query) alias;
eg Oracle: select * from (your select query) alias where alias.rownum=1;
这篇关于如何从结果中只获取一条记录...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文