473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Creating a view

I am having a terrible time trying to create a view. Here is the sql
string:

$sql = "CREATE VIEW v AS SELECT * FROM t1;";

Here is the error:

You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near 'VIEW v
AS SELECT FROM t1' at line 1

So simple, yet so vexing. Any thoughts? Thanks,

-- whit nelson

Sep 2 '06 #1
4 1292
Whit wrote:
I am having a terrible time trying to create a view. Here is the sql
string:

$sql = "CREATE VIEW v AS SELECT * FROM t1;";

Here is the error:

You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near 'VIEW v
AS SELECT FROM t1' at line 1

So simple, yet so vexing. Any thoughts? Thanks,

-- whit nelson
This isn't a PHP question. Try a mysql newsgroup - such as
comp.databases.mysql.

And ensure your version of MySQL supports views.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 3 '06 #2
Hello.

Perhaps it's only the the ";" within the command at the end ?
....SELECT * FROM t1;"; <- the one in front of the "

The error in syntax message doesn't have this one.

Hope helps,
Wolfgang
"Whit" <wh********@gmail.comschrieb im Newsbeitrag
news:11*********************@i3g2000cwc.googlegrou ps.com...
I am having a terrible time trying to create a view. Here is the sql
string:

$sql = "CREATE VIEW v AS SELECT * FROM t1;";

Here is the error:

You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near 'VIEW v
AS SELECT FROM t1' at line 1

So simple, yet so vexing. Any thoughts? Thanks,

-- whit nelson
Sep 3 '06 #3
Whit wrote:
I am having a terrible time trying to create a view. Here is the sql
string:

$sql = "CREATE VIEW v AS SELECT * FROM t1;";

Here is the error:

You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near 'VIEW v
AS SELECT FROM t1' at line 1

So simple, yet so vexing. Any thoughts? Thanks,

-- whit nelson
Looks fine to me. So make sure the version of MySQL you have supports
view. It started to be supported in MySQL version 5.0. The ';' in the
SQL statement is fine. It is a cmd terminator in SQL.

IMHO - If you want to use a view I would use it on complicated SQL table
relationships. I see no reason to build a view based on just one SQL table.

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Sep 3 '06 #4
I would concur.

My hosted service doesn't support views. I had to write a 5 nested
level select statement to do what I wanted. Seeing as you have to
write the complicated SQL to generate a view anyway, why not just stick
it in a function and call it with the required parameters. How big is
the database and what is the likely overhead.

Obiron

Sep 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dave | last post by:
I first started using HCW.exe to compile .rtf filew created with MS Word a couple of weeks ago. I used the file | new menu then selected New project in the dialog box and everything worked as...
3
by: Indraneel Sheorey | last post by:
Hello, I want to set up a query in SQL Server that is "grouped by" a variable PRICE. Since PRICE takes on continuous decimal values, I want to create deciles based on this variable and then...
1
by: RJMAL | last post by:
Recently we upgraded our server from SQL 7.0 to SQL 2000. I created a new view in Enterprise Manager which pulls data from a linked server's database. When I write the view... CREATE VIEW...
31
by: Neil | last post by:
I have an Access 2000 MDB with ODBC linked tables to a SQL Server 7 back end. I currently have a selections table in the front end file which the users use to make selections of records. The table...
2
by: Iain Miller | last post by:
Now this shouldn't be hard but I've been struggling on the best way as to how to do this one for a day or 3 so I thought I'd ask the assembled company..... I'm writing an application that tracks...
0
by: billmiami2 | last post by:
Perhaps many of you MS Access fanatics already know this, but it seems that stored procedures and views are possible in Jet. I thought I would leave this message just in case it would help anyone....
13
by: Nagib Abi Fadel | last post by:
Is it possible to create a session variable for each user in Postresql ?? Thx
1
by: kellyj00 | last post by:
Hello. I'm new to the world of the as400, but not to the world of SQL and relational databases. I would like to create a view on our as400 machine, but I understand that creating a view will...
1
by: apothecary | last post by:
Hello Newbie here. Is there a way of creating a VIEW...using a stored procedure. I am basically trying to create a view to return some data that I am getting using a stored procedure. I...
1
by: sainiamit25 | last post by:
Hi, I want to create a materlised view log in my database A and materlised view in some other database B. I was successful in creating materlised view in database B (after creating a dblink with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.