仅选择一个不同的列
我想这是一个很容易解决的问题,但我正在研究一个小时来寻找答案。 我有一个包含三列的表:“id”、“id_x”和“name”。但它填充了重复的值,如下所示:
id id_x name
1 100 Name_aaa
2 100 Name_aaa
3 100 Name_aaa
4 100 Name_aaa*
5 101 Name_bbb
6 101 Name_bbb*
好吧,好吧,我没有创建这个表,我无法修改它们...我只是想知道我可以执行什么查询来仅返回值“100 - Name_aaa” ”和“101 - name_bbb”...请注意,某些名称后面有一个“*”。我只想按“id_x”进行分组。
有没有什么办法可以不使用子查询或连接来做到这一点?
提前致谢!
I guess that is an easy question to solve, but I'm researching for an hour for it's answer.
I have a table with three columns: "id","id_x" and "name". But it's populated with repeated values, like this:
id id_x name
1 100 Name_aaa
2 100 Name_aaa
3 100 Name_aaa
4 100 Name_aaa*
5 101 Name_bbb
6 101 Name_bbb*
Ok, ok, I didn't create this table, and I can't modify them... I just wanna know what query I can execute to return only the values "100 - Name_aaa" and "101 - name_bbb"... Note that has an "*" after some names. I'd like to group only by the "id_x".
Is there any way to do it without using subqueries or joins?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
有点未经测试,但这应该可以
Somewhat untested, but this should do it
试试这个,
Try this,
或者:
Or: