VALUES TRIM(CAST(CAST(YEAR( { fn  TIMESTAMPADD(SQL_TSI_MONTH,  -6  ,  
        CURRENT_DATE) }) AS CHAR(4) ) AS VARCHAR(4)))  || '-' ||     
        TRIM(CAST(CAST(MONTH( { fn  TIMESTAMPADD(SQL_TSI_MONTH, -6  ,   
          CURRENT_DATE) }) AS CHAR(2) ) AS VARCHAR(2))) 


The above statement returns 5 instead of 05 for MONTH(xxx)
which is not desired. It is not correct for comparisons
as 11 is smaller than 5 where in essense 11 is actually bigger
than 5

Edit:
With the JavaDB/Derby SQL statement above, I'd like to get
for example today is 2013-11-23, six months before was 2013-05-23
When comparing 

select p.ProductCode , p.ProductName as pn, sum( od.NetSales) AS Sales      
 from   
  products p   

  INNER JOIN order_details od ON (p.ProductCode = od.ProductCode)  
  INNER JOIN orders o ON (od.OrderCode = o.OrderCode)   
  where   TRIM(CAST(CAST(YEAR(o.PurchaseDateTime) AS CHAR(4)) AS VARCHAR(4))) || '-' ||    
  TRIM(CAST(CAST(MONTH(o.PurchaseDateTime)  AS CHAR(2)) AS VARCHAR(2)))      
              &gt;

  TRIM(CAST(CAST(YEAR( { fn  TIMESTAMPADD(SQL_TSI_MONTH,  -6   ,   CURRENT_DATE) }) AS CHAR(4) ) AS VARCHAR(4)))  || '-' ||    
  TRIM(CAST(CAST(MONTH( { fn  TIMESTAMPADD(SQL_TSI_MONTH, -6  ,   CURRENT_DATE) }) AS CHAR(2) ) AS VARCHAR(2)))         

       group by p.ProductCode, p.PRODUCTNAME


orders that are within the range are not included.
Whereas I want to include them
Hope you understand

Thanks
Jack


Question: Does reach let you threaten an opponent if there is another opponent between you?
Answer: You would flank, but cannot make Attacks of Opportunity*

Threatening


  Threatened Squares: You threaten all squares into which you can make a
  melee attack, even when it is not your turn. Generally, that means
  everything in all squares adjacent to your space (including
  diagonally). An enemy that takes certain actions while in a threatened
  square provokes an attack of opportunity from you. If you're unarmed,
  you don't normally threaten any squares and thus can't make attacks of
  opportunity.


AoO Rule:


  Cover and Attacks of Opportunity: You can't execute an attack of
  opportunity against an opponent with cover relative to you.


Soft Cover Rule:


  Soft Cover: Creatures, even your enemies, can provide you with cover
  against ranged attacks, giving you a +4 bonus to AC. However, such
  soft cover provides no bonus on Reflex saves, nor does soft cover
  allow you to make a Stealth check.


Those both come from the PRD section on Combat

As @Jim Kiley notes, there is no rule that states cover negates threatening. Just that it negates taking AoOs.

So, yes, the creature would provide a flanking bonus, but would be unable to make attacks of opportunity.

*This is muddied a bit by the fact that "Threatened Squares" are only described under attacks of opportunity, and it is a bit unclear if "threaten" == "can make an AoO". RAW, they're not technically the same thing, and thus my interpretation.

Edit: Turns out Creatures are only cover against ranged attacks, (double edit) but you determine cover as if with range if the target is not adjacent.


  When making a melee attack against a target that isn't adjacent to you
  (such as with a reach weapon), use the rules for determining cover
  from ranged attacks.


BUT

If the creature is large or larger, it gets to do this (which means if it's hampered by a medium creature it could probably finagle itself outside of cover):


  Big Creatures and Cover: Any creature with a space larger than 5 feet
  (1 square) determines cover against melee attacks slightly differently
  than smaller creatures do. Such a creature can choose any square that
  it occupies to determine if an opponent has cover against its melee
  attacks. Similarly, when making a melee attack against such a
  creature, you can pick any of the squares it occupies to determine if
  it has cover against you.