如果我有一个列表和表格:
a:("12";"34";"56")
bb:([]c:("90";"12";"65"))
我这样做:
a except (select c from bb)
我收到以下错误:
length
[5] (.q.except)
[4] a except (select c from bb)
也许(从bb中选择c)仍然是表格?如何将列转换为列表,以便except语句起作用?
答案 0 :(得分:2)
尝试使用“ exec”,它将返回该列作为列表。
if (followUpDataResponseList.get(fieldSize).getFieldType().equalsIgnoreCase("Textbox")) {
View view = getLayoutInflater().inflate(R.layout.my_edittext, null);
editCustom = view.findViewById(R.id.editCustom);
editCustom.setHint(followUpDataResponseList.get(fieldSize).getValue());
//Set Tag for EditText
editCustom.setTag(fieldSize);
textViewArrayList.add(editCustom);
linearInterestData.addView(view);
} else if (followUpDataResponseList.get(fieldSize).getFieldType().equalsIgnoreCase("Dropdown")) {
View view = getLayoutInflater().inflate(R.layout.my_spinner, null);
spinner = view.findViewById(R.id.spinCustom);
View spinnerView = view.findViewById(R.id.spinnerView);
List < String > spinnerList = new ArrayList < > ();
}
String[] strArray = followUpDataResponseList.get(fieldSize).getPossibleValues().split(",");
List < String > list = Arrays.asList(strArray);
spinnerList.addAll(list);
ArrayAdapter < String > adapterSpinner = new ArrayAdapter < String > (mActivity, R.layout.spinner_text, spinnerList) {
@Override
public boolean isEnabled(int position) {
return position != 0;
}
@Override
public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View mView = super.getDropDownView(position, convertView, parent);
TextView textView = (TextView) mView;
if (position != 0) {
textView.setTextColor(Color.BLACK);
} else {
textView.setTextColor(ContextCompat.getColor(getContext(), R.color.greyTextColor));
}
return mView;
}
};
adapterSpinner.setDropDownViewResource(R.layout.simple_spinner_dropdown);
spinner.setAdapter(adapterSpinner);
//Set Tag for Spinner
spinner.setTag(fieldSize);
linearInterestData.addView(view);
或
a except exec c from bb
答案 1 :(得分:2)
select
确实确实输出了一个表。如果您希望输出为列表,请使用exec
:
q)a except exec c from bb
"34"
"56"
答案 2 :(得分:1)
两个答案都很好,但我个人更喜欢t [`col]
a:("12";"34";"56");
bb:([]c:("90";"12";"65"));
a except bb[`c]
如果动态调用,效果也会更好
答案 3 :(得分:1)
一个选项:
WITH open AS
(
SELECT COUNT(Work_Request_Code) AS OpenCount, Date_Requested AS Date
FROM Tickets_Open
WHERE Date_Requested >='2018-01-01 00:00:00'
GROUP BY(Date_Requested)
)
, close AS
(
SELECT COUNT(Ticket_Request_Code) AS ClosedCount, Date_Requested AS Date
FROM Tickets_Closed
WHERE Date_Requested >='2018-01-01 00:00:00'
GROUP BY(Date_Requested)
)
SELECT
COALESCE(c.Date, o.Date) AS Date
, IFNULL(o.OpenCount, 0) + IFNULL(c.ClosedCount, 0) AS TotalOpen
, IFNULL(c.CountClosed, 0) AS CountClosed
FROM open o
FULL OUTER JOIN closed c ON o.Date = c.Date