Page 1 of 1

error in "view" creation

PostPosted: 12. January 2011 11:00
by manolis1986
I tried to create a view in xampp

CREATE VIEW CompanyTotalCost
AS
SELECT c.Name,
COALESCE(p.TotalCost, 0)
+ COALESCE(s.TotalCost, 0) AS TotalCost
FROM Companies AS c
LEFT JOIN (SELECT CompID, SUM(Cost) AS TotalCost
FROM Products
GROUP BY CompID) AS p
ON p.CompID = c.CompID
LEFT JOIN (SELECT CompID, SUM(Cost) AS TotalCost
FROM Services
GROUP BY CompID) AS s
ON s.CompID = c.CompID

my database is a simple database with 3 tables product(name, cost, id, CompID) services(name, cost, id, CompID) and company(name, id, totalcost)

the xampp appears an error: #1349 - View's SELECT contains a subquery in the FROM clause.
does anyone has any idea about this????

thanks a lot
Manolis

Re: error in "view" creation

PostPosted: 13. January 2011 15:12
by JonB
lets be clear - XAMMP has no views

XAMMP is a suite of components, configured to work together - none of whihc was developed by the XAMPP teams - they only make a distribution system - the XAMPP configuration and its tools/

You are making a MySQL inquiry. the best place for an answer would be a forum that does database or IT emphasis -- you will get better answers, and much more info to sort through -

I can recommend two (besides MySQL's own forums - which tend to be about MySQL itself - not developing queries, directives and applications):

DANIWEB -
http://www.daniweb.com/forums/forum16.html

& Stackoverflow
http://stackoverflow.com/

Good Luck
8)

ypsf