我试图创建一个表custom_table 产品没有价格列,并在PC和笔记本电脑没有一个类型列。 所以我需要知道如何在这种情况下使用with clause创建表? 这里是我的查询 with custom_table(model,type,price)
as
(select model,type from product
union
select model,price from pc
un
问题引用列如下: 我使用子查询,我需要加入 WITH subselect_from_A AS (
SELECT A.A_ID FROM A
)
SELECT B.D_ID FROM B, subselect_from_A WHERE B.B_ID =
A.A_ID
/* or instead: subselect_from_A.A_ID */
; 如何引用子查询的列形式?
试图在SQLAssitant(ⅴ的15.x的Teradata)来执行: WITH TEMP1 (EMP_ID,E_NAME,E_SAL) AS (WITH TEMP (EMP_ID,E_NAME,E_SAL) AS (SELECT EMP_ID,E_NAME,E_SAL FROM EMP_TABLE_TEST)
SELECT EMP_ID,E_NAME,E_SAL FROM TEMP) SELE
我有一个非常复杂的查询,其中包含“With”子句。这个查询在DB2客户端上执行时工作正常。但是,如果在PL SQL存储过程的For循环游标中使用相同的查询,则它不起作用。试图将存储过程应用于数据库时,它会给出语法错误,如下所示。 SQL0104N An unexpected token "AS" was found following "col5)
for循环如下所示。 FOR records
SQL毫无问题运行在DB2 with mytable(a,b) as (
values(
(select current timestamp from sysibm.sysdummy1), (select current timestamp from sysibm.sysdummy1))
)
select * from mytable
我想运行在SQL Server类似的东
我有很长的SQL语句本质上是: with a as (select * from t1),
b as (select * from a, t2 where a.id=t2.id)
select * from b
这条语句执行我的蟾蜍应用完全没有问题。但是,当我尝试上述塞进一个字符串变量,并在ASP中使用运行它: set rs = objConn.execute(strSQL)