我试图想象我如何使用另一个表中的数据替换字符串
我有一个看起来像这样的表:
Id Translation 1 Peter 2 Sandra 3 Olga
现在我想选择all并使用如下所示的列表替换翻译:
Original New e # r ? lg *%
这样选择列表如下所示:
Id Translation 1 P#t#? 2 Sand?a 3 O*%a
因此,对于每个翻译,我需要有一个REPLACE(翻译,原创,新).换句话说:我需要在我的第一个列表中查看每个"翻译"并在替换表中再次循环以查看要替换的内容
请记住,第一个列表有25'000行,第二个列表有50'000,所以我不能手工输入:)
只是为了澄清:我的查找表中的Original和New可以是字母和单词,所以表格看起来像这样:
Original New one two three fifty sun moon
我正在尝试动态地向 chart.js 图表添加线条,但我不知道我有多少数据集,我已经被这个问题困扰了两天了......
我有一个包含年、月和值的列表:
public int Month { get; set; }
public int Year { get; set; }
public int Value { get; set; }
Run Code Online (Sandbox Code Playgroud)
我的 HTML 只是图表的画布:
<div>
<canvas id="myChart"> </canvas>
</div>
Run Code Online (Sandbox Code Playgroud)
我像这样填充图表:
var dataList = [];
var lableList = [];
@foreach (var dataInput in Model.TurnoverByReservation)
{
@:dataList.push("@dataInput.Value");
@:lableList.push("@dataInput.MonthName");
}
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: lableList,
datasets: [
{
label: 'Booking value',
data: dataList,
backgroundColor: backgroundColors,
borderColor: borderColors,
borderWidth: …Run Code Online (Sandbox Code Playgroud) 我有一个看起来像这样的SQL表:
+----+-----------+------------+ | Id | EnquiryId | PropertyId | +----+-----------+------------+ | 1 | 1 | 20 | | 2 | 1 | 25 | | 3 | 1 | 26 | | 4 | 2 | 20 | | 5 | 3 | 20 | | 6 | 4 | 20 | +----+-----------+------------+
我想计算一下propertyid 20有多少查询,以及与其他属性共享多少查询
所以结果应该是这样的:
单个工程数:3
共享查询次数:1
如果它需要两个选择语句,那就完全没问题:)
到目前为止的尝试看起来像这样:
(select count(distinct [EnquiryId])
from [EnquiryProperty] where propertyid=20) as 'SingleEnquiry'
Run Code Online (Sandbox Code Playgroud)
这给了我4个结果(我需要它3)
(select count([PropertyId]) FROM [EnquiryProperty] where propertyid=20 GROUP BY propertyid HAVING …Run Code Online (Sandbox Code Playgroud)