MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 12th, 2012, 05:35 AM
placebo123 placebo123 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 placebo123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 49 sec
Reputation Power: 0
Exclude weekends between two dates

Good morning, this is my Trigger, i juste want to exclude all the saturdays/sundays between these two dates >> x = cf_802 and cf_860

ex1 : if delay(cf_865) < 3days
cf_802 = 16/11/2012 ( Next Friday )
cf_865 = 2days ( cf_865 )

Our will have this date :
cf_860 = 21/11/2012




ex2 : if Delay(cf_865 between 8day and 12 day )
cf_802 = 16/11/2012
cf_865 = 12days

output without weekends : 17 et 18 Non + 24 et 25 Non + 1 et 2 Non
will be >> 04/12/2012


CREATE TRIGGER Before_Update_TriggerAnalyse BEFORE Update ON vtiger_analysecf
FOR EACH ROW
begin
DECLARE x date;
SET x=( select cf_802 from vtiger_echantilloncf where echantillonid in (select echantillonid from vtiger_echantillon where code in (select cf_925 from vtiger_analysecf where cf_925 = NEW.cf_925)));
if NEW.cf_865 < 3 THEN SET NEW.cf_860=TIMESTAMPADD(DAY,1+NEW.cf_865,x);
ELSEIF NEW.cf_865 between '3' AND '8' THEN SET NEW.cf_860=TIMESTAMPADD(DAY,-1+NEW.cf_865,x);
ELSEIF NEW.cf_865 between '8' AND '12' THEN SET NEW.cf_860=TIMESTAMPADD(DAY,-2+NEW.cf_865,x);
ELSE SET NEW.cf_860=TIMESTAMPADD(DAY,-5+NEW.cf_865,x);
END IF;
END;

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Exclude weekends between two dates

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap