1. When you say script, are you talking about a web - scripting language, like PHP?
2. When you say a "view", are you saying that you want to see the results of the query, or that you need to create a database view which is accessible to other queries
3. In MySQL, you use backticks, not brackets to enclose multiple word identifiers, so [Overdue Accounts] would be replaced with ` Overdue Accounts`
Main Topics
Browse All Topics





by: Raynard7Posted on 2007-02-13 at 19:20:27ID: 18528355
Hi,
the use has to be a separate statement.
I'm not sure how you are doing this however I would run a series of statements.
ie
CREATE VIEW `MyDatabase`.`viewName` AS
SELECT a.CustomerID, a.OrderID, c.CompanyName
FROM MyDatabase.Orders a INNER JOIN
MyDatabase.Customers c ON c.CustomerID = a.CustomerID
WHERE EXISTS
( SELECT b.CustomerID
FROM MyDatabase.`Overdue Accounts` b
WHERE b.OrderID = a.OrderID AND b.PaidInFull = 1
)
noting that your square brackets are not mysql syntax but rather microsoft sql server - so I replaced them with `