error in "view" creation

Problems with the Windows version of XAMPP, questions, comments, and anything related.

error in "view" creation

Postby manolis1986 » 12. January 2011 11:00

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
manolis1986
 
Posts: 2
Joined: 02. January 2011 09:25

Re: error in "view" creation

Postby JonB » 13. January 2011 15:12

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
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 73 guests