I have the following little bit of MySQL code
CREATE VIEW UserResults AS
SELECT E.No, E. Description
, Count(R.RID WHERE $Username= R.Owner)
, Count(R.RID WHERE $Username= R.Owner AND Status==’Active’ )
FROM ETable AS E, RTABLE as R
ORDER BY E.No)
but MySQL is returning a syntax error that I can’t seem to find. Also when I have created this view, how can I make it viewable?
ORDER BY.WHEREclause should not be in the middle of theSELECT, you will need to use aCASE.The
R.RIDin theTHENblock of theCASEstatements may need to be a1, not entirely sure what you hoped to get from thoseCOUNTstatements you originally had.I tried to figure out what you were trying to do, and I think this is it: