Questions tagged [mysql-error-1349]

#1349 - View's SELECT contains a subquery in the FROM clause

MySql doesn't allow you to use subqueries in the FROM clause of a VIEW, eg. the following command will throw an error:

CREATE VIEW myView AS
SELECT s.*
FROM (SELECT DISTINCT name FROM yourtable) s

Restrictions on Views

7 questions
60
votes
5 answers

MySQL: View with Subquery in the FROM Clause Limitation

In MySQL 5.0 why does the following error occur when trying to create a view with a subquery in the FROM clause? ERROR 1349 (HY000): View's SELECT contains a subquery in the FROM clause If this is a limitation of the MySQL engine, then why haven't…
Daniel
  • 1,231
  • 3
  • 15
  • 20
3
votes
2 answers

View's SELECT contains a subquery in the FROM clause MySQL statement

I have a enquiry about creating view in MySQL workbench. I have error: " View's SELECT contains a subquery in the FROM clause" when saving. This is a copy of my statement: CREATE VIEW viewMorningReport AS select z.AllocationDate, z.LocationName,…
Philemon
  • 117
  • 1
  • 11
2
votes
1 answer

Creating a left outer join in MySQL with right-hand constraints

As per https://stackoverflow.com/questions/3264227/relations-with-multiple-keys-in-doctrine-1-2, I have two tables which (as I can't get it to work in Doctrine) I'm trying to join as a MySQL…
Parsingphase
  • 501
  • 5
  • 10
2
votes
1 answer

mysql improve view with subquery

I need to compare rows in the same column, so I have the following mysql query which works well giving the expected result. SELECT x.aord, x.anode AS parent, x.bnode AS child FROM (SELECT a.ordinal AS aord, …
digitai
  • 1,870
  • 2
  • 20
  • 37
1
vote
2 answers

SQL Query : Cannot create view due to error #1349 : Help to restructure query

I using a query that selects a check type "checks" and looks in the log file to find the most recent log entry referencing this check. SELECT checks.*, logs.last_completed_on, logs.completed_by FROM checks INNER JOIN ( …
0
votes
1 answer

ERROR 1349 (HY000): View's SELECT contains a subquery in the FROM clause

I do not want to create two separate views. create view fg_voted as ( select * from (select f1.foto, count(f1.vote) stars,f1.vote, f1.voted from fg_foto_bewertung f1 where f1.vote >= 3 group by f1.foto, f1.vote)…
Fam Khan
  • 51
  • 1
  • 3
0
votes
1 answer

MySQL Cannot create view for subquery in from clause

I'm trying to make query that will display top 10 Systems and the 'Other' as 11th row. I made union query. I found that the query I build returns the 'Other' record for each System name that is not in Top10, so I made select in select to sum all…
Zibi
  • 1
  • 2