Bookmarking a query helps you to reuse a query in the administrator tool, but it won't let you use that alias from other applications that use the database.
The think you are looking for, is a view
. See: http://dev.mysql.com/doc/refman/5.0/en/create-view.html
The syntax would be:
CREATE VIEW eng_schedule AS
SELECT
s.WO_NUM,
s.WO_LINE,
s.DESCRIPTION,
s.CUS_LOC_NAME,
s.MFG_LINE,
u1.username,
u1.lastname AS MECHANICAL,
u2.lastname AS APPLICATIONS,
u3.lastname AS DESIGN
FROM production_schedule s, users u1, users u2, users u3
WHERE s.PM_MECHANICAL = u1.USERID
AND s.PM_APPLICATIONS = u2.USERID
AND s.PM_DESIGN = u3.USERID
After that, you can use the name of the view as a table name in select
queries.
B.t.w. if executing a query in PDO fails, you might want to inspect the error information that PDO returns. See: http://nl3.php.net/pdo.errorinfo In this case, you would probably see an error about a missing table, confirming that bookmarking the query indeed didn't work. The error information is useful for yourself and for people helping you, because you will get an actual error message, so you can quickly rule out silly typing errors in the query.