早上好,
我在AS / 400(绿色屏幕)内运行SQL查询,并且在提取别名列名时遇到问题。
这是我的剧本:
/* Join forecast info with item warehouse info */
SELECT item, itmdsc,
today,
October, QSMOIB,
(QSMOIB - October) AS Sales_less_October
FROM
/* Summarizing forecast data in a SQL query */
(SELECT item, itmdsc, whse,
today, range,
(wk01 + wk02 + wk03 + wk04) AS October
FROM FCSTCUR) AS f
JOIN
/* Select "Qty sold this period" */
(SELECT ITNOIB, WHIDIB, QSMOIB
FROM ITEMBLL0) AS iw
ON f.item = iw.ITNOIB AND
f.whse = iw.WHIDIB
WHERE Sales_less_October <> 0
ORDER BY Sales_less_October ASC
当我运行它时,我收到错误:
Column or global variable SALES_LESS_OCTOBER not found.
但是,如果我将脚本更改为以下内容,它将按预期工作:
/* Join forecast info with item warehouse info */
SELECT item, itmdsc,
today,
October, QSMOIB,
(QSMOIB - October) /* AS Sales_less_October */
FROM
/* Summarizing forecast data in a SQL query */
(SELECT item, itmdsc, whse,
today, range,
(wk01 + wk02 + wk03 + wk04) AS October
FROM FCSTCUR) AS f
JOIN
/* Select "Qty sold this period" */
(SELECT ITNOIB, WHIDIB, QSMOIB
FROM ITEMBLL0) AS iw
ON f.item = iw.ITNOIB AND
f.whse = iw.WHIDIB
WHERE (QSMOIB - October) <> 0
ORDER BY (QSMOIB - October) ASC
我简单地更换了&#34; Sales_less_October&#34; (QSMOIB - 十月)。
我真的希望能够使用别名,因为它比显示更清晰&#34;数字表达&#34;:
非常感谢,抱歉,我无法上传数据......它在我们的服务器上。
答案 0 :(得分:2)
如果您想在val similarities = ratingPairs.map(row => {
val ratings1 = sc.parallelize(row.getAs[Seq[Double]]("ratings1"))
val ratings2 = sc.parallelize(row.getAs[Seq[Double]]("ratings2"))
val corr:Double = Statistics.corr(ratings1, ratings2)
Similarity(row.getAs[Long]("ID"), corr)
})
和<TextView
android:id="@+id/textViewGuessGame"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:text="Guess Game"
android:textSize="24sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:layout_editor_absoluteY="6dp" />
<TextView
android:id="@+id/textViewGameRules"
android:layout_width="wrap_content"
android:layout_height="61dp"
android:text="Game rules: guess the wrong number and you loose a point. Guess the right number and get one point "
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="0.13"
tools:layout_editor_absoluteY="54dp" />
<TextView
android:id="@+id/textViewResult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:text="Points : 0 "
tools:layout_editor_absoluteY="233dp"
app:layout_constraintHorizontal_bias="0.455" />
<Button
android:id="@+id/buttonL"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="0"
tools:layout_editor_absoluteX="37dp"
tools:layout_editor_absoluteY="146dp" />
<Button
android:id="@+id/buttonR"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="0"
tools:layout_editor_absoluteX="208dp"
app:layout_constraintBaseline_toBaselineOf="@+id/buttonL" />
子句中使用别名,则可以在WHERE
中嵌套查询的其余部分时执行此操作:
ORDER BY