db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John English <john.fore...@gmail.com>
Subject Re: Week number of the year CASE statement query
Date Fri, 12 Aug 2011 08:41:18 GMT
On 10/08/2011 17:12, Conor66 wrote:
> Thanks for your reply. Yes I looked into Calendar.WEEK_OF_YEAR, I came across
> it after I wrote that CASE statement and it would definitely be a better way
> to do this. But Im wondering how to get the weeks where nothing happens, so
> that I can have zero values also, not just the weeks where something
> happens.

Left join should do the trick; A left join B on C will give you all the
rows from A, with either matching data from B or nulls where there is no
matching data. A case clause can be used to turn the nulls into zeroes
or whatever else is needed.


  John English | My old University of Brighton home page is still here:
               | http://www.it.brighton.ac.uk/staff/je

View raw message