我需要将concat函数的输出与where子句和like子句匹配。以下是我的查询
ng-model
我需要找到
的匹配结果<div ng-app="myApp" >
<div ng-controller="myCtrl">
<input type="text" ng-model="name">
<button ng-click="just()">submit</button>
</div>
<div ng-controller="myCtrl2">
<input type="text" ng-model="name2">
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.name="before";
$scope.just = function()
{
$scope.name="after";
$scope.name2="after"; ///// this is not working
}
});
</script>
和
SELECT t.id,
concat(trim(t.address1), ', ',t.zip, ' ',trim(t.city), ', ',c.countryName ) AS fullAddress
FROM `User` `t`
INNER JOIN Country c ON t.countryCode = c.countryCode
...
27 Avenue Pasteur, 14390 Cabourg, France
答案 0 :(得分:2)
在查询中的最终t.zip之前,您在','中缺少空格。
应该是:
SELECT t.id, concat(trim(t.address1), ', ',t.zip, ' ',trim(t.city), ', ',c.countryName ) AS fullAddress FROM `User` `t` INNER JOIN Country c ON t.countryCode = c.countryCode WHERE (((address1 IS NOT NULL AND zip IS NOT NULL AND city IS NOT NULL AND t.countryCode IS NOT NULL) AND (concat( t.address1, ', ', t.zip, ' ', t.city, ', ', c.countryName ) regexp '^[0-9]+,? [^,]+, [0-9]+,? [^,]+, [a-zA-Z]+$')) AND (concat(' ',trim(t.address1), ', ',t.zip,' ', trim(t.city), ', ', c.countryName) like '%27 Avenue Pasteur, 143%'))