Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Paste Description for pb

MySQL and groups with HAVING

pb
Tuesday, July 10th, 2007 at 11:31:49am MDT 

  1. Works, kind of...
  2. SELECT distinct area_code as AC, phone_num as PN, ord_date, store_num
  3. FROM `orders_p`
  4. GROUP BY AC, PN
  5. HAVING min(ord_date)>='20070101' and min(ord_date)<='20070128'
  6.  
  7. Returns empty set... (?!)
  8. SELECT count(*), ord_date, store_num
  9. FROM `orders_p`
  10. GROUP BY store_num
  11. HAVING min(ord_date)>='20070101' and min(ord_date)<='20070128'
  12.  
  13. Hoping to get something like:
  14.  
  15. count(*)  ord_date  store_num
  16. --------- --------- -----------
  17.     35     20070101   1
  18.     24     20070101   2
  19.     36     20070101   3
  20. [etc.]
  21.  
  22. (The value in ord_date isn't meaningful and probably can be removed from the columns.)

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

fantasy-obligation
fantasy-obligation