我怎么写这个.. [英] How do I.write this..
问题描述
员工表名称字段包含 lastname
, firstname
。这是一个逗号分隔的字段。它们不是两个不同的列。在单个列中,它包含姓氏和名字,逗号为分隔符,表包含3毫安数据。
我需要将员工表中的姓氏(5)+名字(3)+ dob与另一个表中的列进行比较。如果他们匹配,那么我会将他们添加到列表中
这里我们需要从姓氏前5个字符和名字中的3个字符
员工
employee table name field contains lastname
, firstname
. It is a comma seperated field. They are not two different columns. In a single column it contains both lastname and first name with comma as separator and table contains 3 milliion data.
i need to compare this lastname(5)+firstname(3)+dob from employee table to column in another table. If they match then i will add them to list
here we need to take first 5 characters from lastname and 3 from firstname
employee
name dob
jan,doe 06/06/1945
james,smith 04/09/2001
lo,ab 06/01/2002
其他表格
other table
jan**doe19450606
jamessmi20010904
lo***ab20020106
正如我所提到的,我需要使用linq查询匹配这两个表并生成结果。
只需要表列比较而不是列表比较
As i mentioned, i need to match on these two tables using linq query and produce the result.
Just need table column comparison not list comparison
推荐答案
这个怎么样:
public static string CreateRecord(Employee e)
{
return (e.FirstName + new string('*', 5)).Substring(0, 5)
+ (e.LastName + new string(' ', 3)).Substring(0, 3).TrimEnd()
+ Regex.Replace(e.Dob, @"^(\d{2})/(\d{2})/(\d{4})
,
", "
3
>
这篇关于我怎么写这个..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!