我有一张桌子,我在 data_id 上有自动编号/序列
tabledata
---------
data_id [PK]
data_code [Unique]
data_desc
Run Code Online (Sandbox Code Playgroud)
示例代码:
insert into tabledata(data_code,data_desc) values(Z01,'red')
on conflict (data_code) do update set data_desc=excluded.data_desc
Run Code Online (Sandbox Code Playgroud)
工作正常,然后我再次插入
insert into tabledata(data_code,data_desc) values(Z01,'blue')
on conflict (data_code) do update set data_desc=excluded.data_desc
Run Code Online (Sandbox Code Playgroud)
我收到这个错误
[Err] 错误:ON CONFLICT DO UPDATE 命令不能再次影响行 提示:确保建议在同一命令中插入的行没有重复的约束值。
这是我的真实代码
insert into psa_aso_branch(branch_code,branch_desc,regional_code,status,created_date,lastmodified_date)
(select branch_code, branch, kode_regional,
case when status_data='Y' then true
else false end, current_date, current_date
from branch_history) on conflict (branch_code) do
update set branch_desc = excluded.branch_desc, regional_code = excluded.regional_code,status = (case when excluded.status='Y' then true …Run Code Online (Sandbox Code Playgroud) 我尝试使用 javascript 禁用我的特定引导程序选择选项。
我知道如何禁用“普通选择选项”,但是在使用引导选择时它不起作用(它被禁用/变灰但我仍然可以选择它)在这里jsfidle
<select name="dropdownBranch" id="dropdownBranch" class="selectpicker" data-live-search="true">
<option value="0">Choose Number</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<select id="pureDropDown">
<option value="0">Choose Number</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<button onclick="disableDropdown()">disable</button>
function disableDropdown(){
var selectobject;
selectobject=document.getElementById("dropdownBranch").getElementsByTagName("option");
selectobject[3].disabled=true;
selectobject=document.getElementById("pureDropDown").getElementsByTagName("option");
for(z=0;z<selectobject.length;z++){
selectobject[z].disabled=true;
}
}
Run Code Online (Sandbox Code Playgroud)
我也尝试删除特定选项,并且发生了同样的情况(在正常下拉菜单上工作,但在引导选择上不起作用)
正如标题所说,我需要使用此查询(无字符串 Agg)将结果查询与字符串 agg 连接起来
select pdet.dept_id, pdet.grade_id
from psa_aso_target ptar
inner join psa_aso_targetdetails pdet on pdet.target_id=ptar.target_id and ptar.branch_id='18'
Run Code Online (Sandbox Code Playgroud)
结果是这样的
然后我添加字符串 agg
select pdet.dept_id, string_agg(distinct pdet.grade_id::char,'|') as grade
from psa_aso_target ptar
inner join psa_aso_targetdetails pdet on pdet.target_id=ptar.target_id and ptar.branch_id='18'
group by pdet.dept_id
Run Code Online (Sandbox Code Playgroud)
我希望结果结果是
dept_id | grade_id
2 | 1|2|3
3 | 4|13|14|15|18
5 | 6|10|17
63 | 2|4|7
Run Code Online (Sandbox Code Playgroud)
但我得到的结果是
dept_id | grade_id
2 | 1|2|3
3 | 1|4
5 | 1|6
63 | 2|4|7
Run Code Online (Sandbox Code Playgroud)
任何的想法?