MySQL Forums
Forum List  »  Microsoft SQL Server

SELECT * FROM {a view}
Posted by: Mert Saka
Date: October 16, 2004 03:40AM

Hi all,

Currently I have a project which I'm trying to migrate to mySQL from MSSQL. But I have a problem with subqueries, in which I'm trying to query a set of results returned from a 'view' I saved in mySampleDB on mySQL 5.0.1. I'm using the driver "myODBC.Standard.3.51.9-win" to connect to my database.

Here is how I have mySampleDB:

Name | Age
Friend1 | 21
Friend2 | 16
Friend3 | 23
Friend4 | 30
Friend5 | 45

>viewOlder: SELECT * FROM 'tableFriends' WHERE Age > 25
Name | Age
Friend4 | 30
Friend5 | 45

>view25_35: SELECT * FROM 'viewOlder' WHERE Age < 30

!!!--> For this query, in which I'm trying to filter results from another view it gives an error, telling me that it needs to be a table for my view to get results from.

(ERROR MESSAGE: ''1146 - Table 'mySampleDB.viewOlder' doesn't exist'')

When I found out that mySQL will be supporting views, I was very excited to see how my MSSQL project will perform on such a fast database engine. Now I don't understand why I cannot call a view from another view. Do I have to CREATE a table and DROP it after I get the results? If that is the case I have lots of queries in view form, and it will be a tough job to do that in a project where there'll be around 10 to 50 clients using these views.

I've already tried other ways of writing these queries but any other syntax wouldn't change anything. Please let me know if there is any other way of doing this. Or is it becausee mySQL cannot handle nested/cascaded views?

Thanx & best regards,


Options: ReplyQuote

Written By
SELECT * FROM {a view}
October 16, 2004 03:40AM
October 18, 2004 08:35AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.