In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] writes:

> Both methods you describe are the commonly used techniques to solve your 
> particular problem. Every RDBMS system I have used responds in exactly the 
> same way to your query. 

> A) a database should not respond with data it does not have.

Correct.

> B) I don't know of a SQL statement (in any SQL dialect) that 
> auto-generates a list of dates (or any other series of values) that you 
> could use in this situation.

PostgreSQL has a set-returning function named generate_series which
can be used on the left-hand side of a LEFT JOIN.  Since MySQL doesn't
seem to have something like that, I often do the following:
* Once and for all create a table containg just integer values,
  e.g. from -50000 to +50000.
* Use a WHERE clause to extract a table slice for the number of days you need
* Use the date functions to convert the table slice to the dates you want
* Use that on the left-hand side of a LEFT JOIN


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to