英文:
How to return entries that have more than one entry per column
问题
让我们假设我有一个这样的表格:
客户 | 地址 |
---|---|
约翰 | 地址 1 |
乔尔 | 地址 1, 地址 2 |
莎拉 | 地址 3, 地址 4 |
我想要返回一个这样的表格:
客户 | 地址 |
---|---|
乔尔 | 地址 1, 地址 2 |
莎拉 | 地址 3, 地址 4 |
我应该如何做到这一点?
我不知道要使用哪些语句。
英文:
Let's say I have a table like this:
Client | Address |
---|---|
John | Address 1 |
Joel | Address 1, Address 2 |
Sarah | Address 3, Address 4 |
And I want to return a table like this:
Client | Address |
---|---|
Joel | Address 1, Address 2 |
Sarah | Address 3, Address 4 |
How would I do that?
I don't know which statements to use
答案1
得分: 1
以下是要翻译的内容:
首先,当决定如何对数据进行筛选时,您总是希望找到一个可用于创建筛选条件的识别因素。
对于您的示例数据,一个识别因素是仅存在于具有两个地址的条目中的逗号。因此,适用于您的示例数据的筛选条件是:
WHERE Address LIKE '%,%'
英文:
The first thing you always want to do when deciding how to filter on data is find an identifying factor that you can leverage to create said filter.
For your example data, an identifying factor is the comma that only exists in entries with two addresses. So a filter that would work on your example data is:
WHERE Address LIKE '%,%'
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论