您好,我想在一个查询中从两个不同的表中获取数据,但是我无法获取唯一的数据.这是我的查询成功执行,但是我无法获取唯一的标题名称.这是我的查询..
Hi every one i want to fetch the data from two different table in a single query, but i am unable to fetch the unique data. this is my query executed successfully, but i unable to fetch the unique tittle name.this is my query..
Select Top 4 PC.Title,IM.ImageName,IM.ImageTitle,IM.ImageLocation,IM.ImageId from Images IM inner join PhotoCategory PC ON PC.AutoId = IM.Category我的第一张桌子是PhotoCategory,第二张是图像.在我的第一个表格中有autoid和title.在Images中,标题是常见的,在其中发送autoid,我借助类别来获取标题.查询已成功执行,但是给出了相同的标题名称,并且我要唯一的数据. 请任何人帮我..... 在此先感谢...
my frist table that is PhotoCategory and second is images. In my first table has autoid and title. In Images title is common, in which i send the autoid, i am fetching the title with the help of category. query is executed successfully, but it give the same title name, and i want to unique data. Please can any one help me..... Thanks in advance...
推荐答案朋友,谢谢您的答复,我已经解决了我的问题.. 解决方案是.. Hi Friends Thanks For Reply, I have solved my problem.. Sollution is.. select IM.ImageName,IM.ImageLocation,IM.ImageTitle,IPT.Title from Images IM inner join (select PC.autoid,PC.Title , max(IG.Autoid)as ''IGID''from PhotoCategory PC inner join Images IG on IG.category = PC.Autoid group by PC.autoid ,PC.Title)IPT ON IPT.IGID = IM.AutoId