无法避免重复的结果 [英] Cannot avoid duplicate results

查看:74
本文介绍了无法避免重复的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个表(Items,ItemProperties和ItemPropertyKeys)。 ItemPropertyKeys包含项目的标题,数量,作者等属性键,ItemProperties包含实际属性(作者姓名,项目标题等)可能有多个属性引用单个项目的一个键(例如,该项目可能有多个名称)。


示例:

项目SomeSong

ItemPropertyKey title

ItemProperty#1,带有关键标题 - > Lalala

ItemProperty#2,带有关键标题 - > Bla bla bla


通缉结果:

项目主题标题

SomeSong标题Lalala(或 Bla bla bla)


到目前为止收到的结果

项目主题标题

SomeSong标题Lalala

SomeSong标题Bla bla bla


我需要选择项目(例如按日期范围)和他们的标题但是如果一个项目有多个标题我需要只选择其中一个。

到目前为止我已经尝试了所有东西并没有运气。而且我也不应该使用存储过程。


希望我已经足够清楚。


帮助将不胜感激。


提前谢谢。

I have 3 tables (Items, ItemProperties and ItemPropertyKeys). ItemPropertyKeys contains of property keys like title, quantity, author for the items and ItemProperties contains the actual property (the name of the author, the title of the item etc.) There could be more than one property refering to one key for a single item (for example the item could have more than one names).

Example:
Item SomeSong
ItemPropertyKey title
ItemProperty #1 with key title -> "Lalala"
ItemProperty #2 with key title -> "Bla bla bla"

Wanted Result:
Item Key Title
SomeSong title "Lalala"(or "Bla bla bla")

Received Result so far
Item Key Title
SomeSong title "Lalala"
SomeSong title "Bla bla bla"

I need to select items (for example by date range) and theirs titles but if an item has more than one title I need to select only one of them.
I''ve tried everything so far and had no luck. And also I shouldn''t use stored procedures.

Hope I''ve been clear enough.

Help will be appreciated.

Thanks in advance.

推荐答案

您能否发布您尝试过的源代码?
Could you please post your source code that you have tried do far?


展开 | 选择 | Wrap | 行号


试试这个:

Try this:

展开 | 选择 | Wrap | 行号


这篇关于无法避免重复的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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