MySQL Forums
Forum List  »  Newbie

Re: Return 0 for data with no matching values
Posted by: Peter Brawley
Date: March 23, 2015 11:30AM

You need to read about Select syntax.

...from foo f... declares f as an alias for table foo.

select distinct year(datevalue) yr retrieves just one instance of each value set found; `yr` gives it an alias name that can be referenced from a Group By or having clause, or from an outer query.

So that we are no longer working in the dark, post the results of Show Create Table (not Describe Table) for the calendar table and the data table.



Edited 1 time(s). Last edit at 03/23/2015 02:13PM by Peter Brawley.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.