返回唯一记录 [英] Returning unique records

查看:78
本文介绍了返回唯一记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难过,我的大脑都被炸了!!!!


我有以下数据

+ ------- + ------------------------------ + ------------ +

| resID | FLEName | VersionNbr |

+ ------- + ------------------------------ + ------------ +

| 1 | 35_laserdatandria2104.zip | 1.0 |

| 2 | 35_laserdatandria2104 [1] .zip | 1.23 |

| 3 | 35_microweb1.31.zip | 1.0 |

| 4 | 35_microweb1.31 [1] .zip | 1.234 |

| 5 | 35_microweb1.31 [2] .zip | 1.345 |

| 6 | 35_microweb1.31 [3] .zip | 1.456 |

+ ------- + ------------------------------ + ------------ +


我需要能够只返回resID 2和6.


有人可以给我任何指示吗?


非常感谢

---------------- -----------------------------------------------
jn******@yourpantsyahoo.com.au :脱掉裤子回复

---------------------------------------------- -----------------

解决方案

Jeff North写道:

我需要能够只返回resID 2和6。




从yourtablename中选择resID,其中resID在(2,6);


我认为这不是问题所在。我想,Jeff希望得到最新版本的

文件名。


有一些信息不足以实现这一点,因为MySQL可以'' t

清楚地从文件名中识别程序。也许有解决方案

带子串并找到提取程序名称,但这不是
a 100%证明解决方案。


我建议添加另一个表,其中存储程序名称,

与此表有关系。然后就可以加入两个表格,并且

选择每个程序的最大版本号。


Markus

2005年10月27日星期四14:06:51 GMT,在mailing.database.mysql Aggro

< sp ********** @ yahoo.com>写道:

| Jeff North写道:
|
| >我需要能够只返回resID 2和6.
|
|从yourtablename中选择resID,其中resID在(2,6);




对不起,我应该更清楚我的帖子(我做的是我的大脑是

scambled LOL)。


我需要检索最高版本号和/或lates文件

即myfile [3]。 zip。

---------------------------------------- -----------------------
jn ******@yourpantsyahoo.com.au :脱掉裤子回复

-------------------- -------------------------------------------


I''m stumped and my brains are fried!!!!

I have the following data
+-------+------------------------------+------------+
| resID | FLEName | VersionNbr |
+-------+------------------------------+------------+
| 1 | 35_laserdatandria2104.zip | 1.0 |
| 2 | 35_laserdatandria2104[1].zip | 1.23 |
| 3 | 35_microweb1.31.zip | 1.0 |
| 4 | 35_microweb1.31[1].zip | 1.234 |
| 5 | 35_microweb1.31[2].zip | 1.345 |
| 6 | 35_microweb1.31[3].zip | 1.456 |
+-------+------------------------------+------------+

I need to be able to return only resID 2 and 6.

Can anybody give me any directions on how to do this?

Many thanks
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------

解决方案

Jeff North wrote:

I need to be able to return only resID 2 and 6.



select resID from yourtablename where resID in(2,6);


I think that''s not what the problem is. I guess, Jeff wants to get the
filename with the latest version.

There''s some information missing to accomplish this, because MySQL can''t
clearly identify the program out of the filename. Maybe there are solutions
with substring and locate to extract the program name, but this wouldn''t be
a 100 % proof solution.

I would recommand adding another table, where the program names are stored,
with a relation to this table. Then it''s possible to join the two tables and
select for the maximum version number for each program.

Markus


On Thu, 27 Oct 2005 14:06:51 GMT, in mailing.database.mysql Aggro
<sp**********@yahoo.com> wrote:

| Jeff North wrote:
|
| > I need to be able to return only resID 2 and 6.
|
| select resID from yourtablename where resID in(2,6);



Sorry, I should''ve been clearer in my posting (I did sa my brains were
scambled LOL ).

I need to retrieve the highest version number and/or the lates file
i.e. myfile[3].zip.
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------


这篇关于返回唯一记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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