我有两个表:
T1 :
CODE FULL_NAME
和 T2 :
CODE FIRST_NAME LAST_NAME
所有列的类型均为NVARCHAR
。
CODE
中的某些T1
单元为空,我需要从T2
中获取它们。我需要在FULL_NAME
中使用T1
信息,并在LAST_NAME
的{{1}}和FIRST_NAME
列中进行搜索。如何写这样的T2
?
到目前为止,我写的是:
UPDATE
LEN(child_iin)<1;
但未成功。
编辑:
我不能只使用UPDATE IMPORT_DATA.RDBS_DATA_STORAGE
SET child_iin = pd.iin
FROM IMPORT_DATA.RDBS_DATA_STORAGE
INNER JOIN nedb.PERSONAL_DATA pd ON child_iin LIKE 'N' + '%' + pd.LAST_NAME + '%' + ' ' + 'N' + '%' +
pd.FIRST_NAME + '%'
,因为我会遇到WHERE t1.FULL_NAME=t2.FIRST_NAME + ' ' + t2.LAST_NAME
= t1.FULL_NAME
和'Jorsh Arthur Weasley'
= t1.FIRST_NAME
,{{1} } = {'William'
。
也。
我需要使用t2.LAST_NAME
,因为正如我所说的,列是'Weasley'
的类型,并且那里有非ASCII字母,所以例如:
N
不重播任何内容,要解决此问题,我必须添加NVARCHAR
:SELECT * FROM T1 WHERE CODE = 'Неважно'
返回一行。
答案 0 :(得分:1)
您可以在下面尝试
UPDATE T1 SET T1.CODE = T2.Code
From T1
Join T2 on t1.FULL_NAME= t2.FIRST_NAME + ' ' +t2.LAST_NAME
答案 1 :(得分:1)
我认为您很简单:
UPDATE t1
SET t1.code = t2.code
FROM t1 INNER JOIN
t2
ON t1.FULL_NAME = t2.FIRST_NAME + ' ' + t2.LAST_NAME
WHERE t1.code IS NULL;
答案 2 :(得分:0)
这是答案:
- (void)DrawCurvedPolylineOnMapFrom:(CLLocationCoordinate2D)startLocation To:(CLLocationCoordinate2D)endLocation
{
GMSMutablePath * path = [[GMSMutablePath alloc]init];
[path addCoordinate:startLocation];
[path addCoordinate:endLocation];
// Curve Line
double k = 0.2; //try between 0.5 to 0.2 for better results that suits you
CLLocationDistance d = GMSGeometryDistance(startLocation, endLocation);
float h = GMSGeometryHeading(startLocation , endLocation);
//Midpoint position
CLLocationCoordinate2D p = GMSGeometryOffset(startLocation, d * 0.5, h);
//Apply some mathematics to calculate position of the circle center
float x = (1-k*k)*d*0.5/(2*k);
float r = (1+k*k)*d*0.5/(2*k);
CLLocationCoordinate2D c = GMSGeometryOffset(p, x, h + -90.0);
//Polyline options
//Calculate heading between circle center and two points
float h1 = GMSGeometryHeading(c, startLocation);
float h2 = GMSGeometryHeading(c, endLocation);
//Calculate positions of points on circle border and add them to polyline options
float numpoints = 100;
float step = ((h2 - h1) / numpoints);
for (int i = 0; i < numpoints; i++) {
CLLocationCoordinate2D pi = GMSGeometryOffset(c, r, h1 + i * step);
[path addCoordinate:pi];
}
//Draw polyline
GMSPolyline * polyline = [GMSPolyline polylineWithPath:path];
polyline.map = mapView;
polyline.strokeWidth = 3.0;
NSArray *styles = @[[GMSStrokeStyle solidColor:kBaseColor],
[GMSStrokeStyle solidColor:[UIColor clearColor]]];
NSArray *lengths = @[@5, @5];
polyline.spans = GMSStyleSpans(polyline.path, styles, lengths, kGMSLengthRhumb);
GMSCoordinateBounds * bounds = [[GMSCoordinateBounds alloc]initWithCoordinate:startLocation coordinate:endLocation];
UIEdgeInsets insets = UIEdgeInsetsMake(20, 20, 20, 20);
GMSCameraPosition * camera = [mapView cameraForBounds:bounds insets:insets ];
[mapView animateToCameraPosition:camera];
}
UPDATE IMPORT_DATA.RDBS_DATA_STORAGE
SET child_iin = pd.iin
FROM IMPORT_DATA.RDBS_DATA_STORAGE
INNER JOIN nedb.PERSONAL_DATA pd
ON child_iin LIKE '%' + pd.LAST_NAME + '%' + ' ' + '%' + pd.FIRST_NAME + '%'
WHERE LEN(child_iin) < 1;
是不必要的