Is a recursive CTE stmt valid without UNION ALL? [closed] - sql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 days ago.
This post was edited and submitted for review 4 days ago.
Improve this question
Is the below recursive CTE statement, without a UNION ALL, syntactically valid? If it is should it return an error?
I have tried it on Mysql by adding the 'recursive' keyword after 'WITH' and it returns 3573 error. Informix on the other hand accepts the syntax but runs in a loop.
CREATE TABLE A(id int);
WITH T
AS (SELECT id FROM A, T)
SELECT id FROM T;

Related

SQL update set and select issue, [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 months ago.
Improve this question
I have this code:
SELECT
ZONE_NAME,
ORG_ID,
ORG_SHORT_NAME,
XMSSN_USE
FROM TABLEZ
;
UPDATE TABLEZ
SET TABLEZ.BILL_CYCLE = '1-DEC-2020 4' WHERE (SELECT TABLEZ.XMSSN_USE WHERE TABLEZ.XMSSN_USE=224)
But it doesn't seem to execute. What could be the problem?
You have 2 different query sentences. You should use ; after first query and then write the update query.
Also you need to use some field on the where clause, your where is empty.

Generating Array or Struct in Bigquery [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 months ago.
Improve this question
Im Expecting some functionality like below,
select ARRAY((select distinct Somecolumn from Dataset.tablename) )
select STRUCT((select distinct Somecolumn from Dataset.tablename) )
You can use array_agg function to generate an array, but generating struct is not possible.
select ARRAY_AGG(distinct Somecolumn) from Dataset.tablename

How to remove repeat rows in SQL? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I need to remove repeated records in search result. I have 3 columns (id, worklevel & umobile).
It looks like below:
Red places is repeat but I need just one of them in result.
Try using DISTINCT
SELECT DISTINCT column1, column2, ...
FROM table_name;

The difference between SELECT * and SELECT A.* [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am new to SQL can someone help me understand why do we use Select .* in sql server ? And why is it different from just select * from table name
In some cases we use statements like select .*, firstname , lastname from employee. Just a bit confused.
.* means, select all columns of a table
SELECT A.*,B.Id from A,B select all columns of A and only Id column of B.

Problems with SQL query finding three names with the most records [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a table and I want to display the 3 names (Ted, Ringo, Paul) that have the most records using an SQL query.
It's a primitive question, but please help me.
my table:
SELECT TOP 3 Name
FROM YourTable
GROUP BY Name
ORDER BY COUNT(*) DESC