我在哪里存储邮件联系人数据库中的标签信息
我正在尝试为邮件设置联系人数据库,并且正在尝试完全自动化标签,但不知道如何实现。
我将在数据库中的哪个位置存储将出现在邮寄标签顶部的名称:
- mr &乔·汤姆森
- 女士博士和詹姆斯·贝里·
- 施瓦茨夫人家族
这似乎必须是基于许多不同数据的计算字段。
关于如何拥有邮件数据库并直接生成标签名称有什么建议吗?
I am trying to setup a contacts database for mailings and I am trying to fully automate the labels but can't figure out how.
Where in the database would I store the name that would appear on the top of a mailing label:
- mr & mrs joe thomson
- dr. and mrs james berry
- Schwartz family
This seems like it would have to be a calculated field based on a number of different pieces of data.
Any suggestions on how you have a mailings database and generate names for labels directly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
构建我在上一个问题中建议的数据模型,我将更新
CONTACTS
表以包括:我将决定使用“Thompson Family”来代替 Joe Thompson 先生和 Terry Thompson 夫人以及 Joe 和 Billy基于个人联系人数量 = 2+(同一地址、同一姓氏)。
参考文献:
Building off the data model I suggested in your previous question, I'll update the
CONTACTS
table to include:I would determine to use "Thompson Family" versus Mr. Joe Thompson and Mrs. Terry Thompson and Joe and Billy based on the number of personal contacts = 2+ for the same address, with the same last name.
References:
一个相当标准化的设计看起来像这样:
这些基本上就是你的桌子。然后你可以创建视图:
1.家庭。假设一个家庭至少有一名父母和一名孩子居住在同一地址,并且他们具有相同的姓氏(如果父母和孩子的姓氏不同,您将用他们的全名来写这封信)。
根据您的需要设置格式。
2.无子女的已婚夫妇。
等等。
A fairly normalized design would look something like:
These would basically be your tables. Then you could create views:
1.Family. Assume a family is at least one parent and a child living at the same address, and they share the same surname (in the case of a parent and child having different surnames, you will address the letter to them both by their full names).
Format as you see fit.
2.Married couples with no children.
And so on.
我个人不喜欢在数据库列定义中对这些有效值进行编码。您将承担大量的管理开销。在不同的表中管理这些值更好,但在另一个表中使用外键来读取标签对我来说似乎并不正确。上次我需要做类似的事情时,我将标签列添加为简单的 varchar 列。
但是您如何避免重复和非常相似的标签(例如“先生”和“先生”)?我在列上添加了一个索引,并在前端添加了一个 AJAX 查询来列出所有可用的不同标签并执行自动完成。这真的很棒,因为
这样您就可以允许任何标签,包括“先生和夫人”。或“教授、博士、博士”。
I personally don't like encoding these kind valid values in the database column definition. You'd have a large administration overhead. Managing these values in a distinct table is better, but having a foreign key into another table you to read the label just didn't seem right to me. Last time I needed to do something similar I added the column for the label as a simple varchar column.
But what do you do to avoid duplicates and very similar labels (e.g. "Mr" and "Mr.")? I added an index on the column and added an AJAX query in the frontend to list all distinct labels available and perfom an autocompletion. This works really awesome because
This way you'd allow any label including "Mr. and Mrs." or "Prof. Dr. Dr.".
鉴于您的澄清 - 我将创建一个附加表。
我假设您有一个“联系人”表,其中包含不同的人员列表。
您还可以有一个“家庭”表,其中包含姓氏或家庭列表。我会将地址放入此表中。
然后,每个联系人都会有一个将他们与家庭联系起来的字段(即使每个家庭只有一个人)。
每个联系人还将有一个包含 1/0 值的“主要联系人”字段。
然后,您可以具有如下所示的查询逻辑:
您需要使用该逻辑以使其完美,但真正的关键是拥有一个具有单独地址的家庭表和一个包含该地址内的人员的联系人表。
Given your clarifications - I would create an additional table.
I'm assuming you have a "contacts" table which contains a distinct list of people.
You could also have a "household" table which contains a list of last names or households. I would put the address in THIS table.
Then, the each contact person would have a field linking them to a household (even if there is only one person per household.)
Each contact person would also have a field for "primary contact" containing a 1/0 value.
Then, you could have query logic something like the following:
You'll want to play with the logic to get it perfect, but the real key is having a household table with a separate address and a contact table with the people within that address.