mysql 示列

福尔摩斯对我笑 2018-04-19 6425 次 2042条

该SQL语句可以实现如果存在该条数据就执行更新操作,如果不存在新增数据

INSERT INTO `m_keywords` (`keyword`, `date`)
VALUES
    ('seek', '2018-04-20') ON DUPLICATE KEY UPDATE count = count +1

if条件判断

SELECT
    *,
IF (
    C_CUSTOMER_CODING = NULL,
    C_CONTRACT_CODE,
    C_CUSTOMER_CODING
) AS total
FROM
    mid_order
WHERE
    MONTH (D_SYS_DATE) = MONTH ('2019-02-02')
AND YEAR (D_SYS_DATE) = YEAR ('2019-02-02')
and C_TWO_TYPE <> "订单"
GROUP BY
    total;

月份和年份的判断

AND YEAR(D_SIG_DATE) = YEAR ('${_this.dateArr[i]}')
month(D_SIG_DATE)= month('${_this.dateArr[i]}')

按最大合同号排重

let sql = `SELECT SQL_CALC_FOUND_ROWS Id,C_ONE_TYPE, C_CONTRACT_CODE, C_CUSTOMER_CODING,C_TER_CUSTOMER, month(D_SIG_DATE),
(Case
when C_ONE_TYPE="零金额订单" then ''
when C_CONTRACT_CODE like "N%" then ''
When C_TER_CUSTOMER='' Then C_CUSTOMER_CODING
WHEN C_TER_CUSTOMER IS NULL Then C_CUSTOMER_CODING
else C_TER_CUSTOMER
End
) As END_USER
FROM mid_order where Id = any(SELECT max(Id) FROM mid_order where month(D_SIG_DATE)= month('${_this.dateArr[i]}') GROUP BY C_CONTRACT_CODE ) AND YEAR(D_SIG_DATE) = YEAR ('${_this.dateArr[i]}')
GROUP BY END_USER;SELECT FOUND_ROWS() AS count`;
标签: 无

非特殊说明,本博所有文章均为博主原创。

下一篇
头像也是LOGO
未来博客 博主大人
到了这个年纪,不应该再彷徨!

发表评论



 


已有 2042 条评论 1


  1. 《바카라사이트》ξ-카지노하는곳-▷트럼프 카드 게임 종류-()メ〔opm65.xyz〕☷[]2019-03-22-16-29[][]☵☎[][]➵[][]┑pl온라인 황금성apN

    It’s hard to come by well-informed people in this particular subject, but you sound like you know what you’re talking about! Thanks

    回复 2020年2月26日
  2. arse

    Having read this I believed it was extremely enlightening. I appreciate you finding the time and energy to put this information together. I once again find myself spending a lot of time both reading and commenting. But so what, it was still worthwhile!

    回复 2020年2月26日
  3. lexus888 alternatif

    Thank you a lot for sharing this with all people you really recognise what you are speaking approximately!
    Bookmarked. Kindly additionally visit my site =).
    We can have a link trade contract between us

    回复 2020年2月26日
  4. Active Lean Keto

    Remarkable! Its genuinely awesome post, I have got much clear idea concerning from this post.

    回复 2020年2月26日
  5. 온라인 카지노

    Sweet blog! I found it while searching on Yahoo News. Do you
    have any suggestions on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there!
    Thank you

    回复 2020年2月26日
  6. バカラ

    I am extremely impressed with your writing skills and also with the
    layout on your blog. Is this a paid theme or did you modify it yourself?
    Either way keep up the excellent quality writing, it is rare
    to see a great blog like this one these days.

    回复 2020年2月26日
  7. pussy

    It’s hard to find experienced people about this topic, but you sound like you know what you’re talking about! Thanks

    回复 2020年2月26日
  8. orgasm

    That is a great tip especially to those fresh to the blogosphere. Simple but very accurate information… Thanks for sharing this one. A must read article!

    回复 2020年2月26日
  9. cockfucker

    After looking into a number of the blog posts on your site, I seriously like your way of blogging. I saved as a favorite it to my bookmark site list and will be checking back in the near future. Please visit my web site as well and tell me what you think.

    回复 2020年2月26日
  10. 샌즈카지노

    Car-Go UNO – Take UNO alongside in the automotive! Car-Go Fun UnoNow you possibly can take
    UNO wherever your automotive go! Shaped like a thermos, the UNO Car-GO
    container fits into most cup holders. https://uricasino369.com/

    回复 2020年2月26日
  11. 샌즈카지노

    Car-Go UNO – Take UNO alongside in the automotive! Car-Go Fun UnoNow you
    possibly can take UNO wherever your automotive go!
    Shaped like a thermos, the UNO Car-GO container fits into most cup holders. https://uricasino369.com/

    回复 2020年2月26日
  12. black cock

    Great article! We are linking to this particularly great post on our website. Keep up the good writing.

    回复 2020年2月26日
  13. negro

    Greetings! Very helpful advice within this post! It is the little changes which will make the largest changes. Thanks for sharing!

    回复 2020年2月26日
  14. dummy

    bookmarked!!, I really like your web site!

    回复 2020年2月26日
  15. xxx free porn movies

    If some one wants expert view regarding blogging then i propose him/her to pay a quick visit this blog, Keep up the nice job.

    回复 2020年2月26日
  16. erect

    I wanted to thank you for this wonderful read!! I certainly loved every bit of it. I have you book-marked to look at new things you post…

    回复 2020年2月26日
  17. fuckass

    There is definately a lot to learn about this topic. I love all the points you made.

    回复 2020年2月26日
  18. 순천출장여대생『카톡: Mo46』Po o34.c0M콜걸강추콜걸출장마사지Y✑♨2019-02-20-21-54순천♀AIJ┱콜걸출장마사지출장마사지미시출장안마⇃콜걸샵┟출장최강미녀☋순천

    Greetings! Very useful advice within this article! It is the little changes that produce the most significant changes. Thanks for sharing!

    回复 2020年2月26日
  19. carnation36.tech.blog

    I’m truly enjoying the design and layout of your site.
    It’s a very easy on the eyes which makes it much more enjoyable for me to come
    here and visit more often. Did you hire out a developer to create your theme?
    Superb work!

    回复 2020年2月26日
  20. 솔레어 카지노

    Its like you read my thoughts! You appear to understand so much about this, such as you wrote the book
    in it or something. I think that you can do with some p.c.
    to force the message home a bit, however instead of that,
    that is magnificent blog. An excellent read. I will certainly be back.

    回复 2020年2月26日
  21. sexy

    After I originally commented I seem to have clicked the -Notify me when new comments are added- checkbox and now every time a comment is added I get 4 emails with the exact same comment. Perhaps there is a means you are able to remove me from that service? Thank you!

    回复 2020年2月26日
  22. Cheap towing

    Hi there! I’m at work browsing your blog from my new iphone 4!
    Just wanted to say I love reading your blog and look forward to all your posts!
    Carry on the fantastic work!

    回复 2020年2月26日
  23. cocksucker

    I really love your blog.. Great colors & theme. Did you build this website yourself? Please reply back as I’m attempting to create my own website and would love to know where you got this from or exactly what the theme is named. Appreciate it!

    回复 2020年2月26日
  24. gapleonline.life

    Sadly, I don’t have time anymore to create game tutorials

    回复 2020年2月26日
  25. assshole

    I blog frequently and I seriously thank you for your information. This great article has really peaked my interest. I will bookmark your blog and keep checking for new details about once a week. I subscribed to your Feed too.

    回复 2020年2月26日
  26. antika eşya alanlar

    Good day! Do you knopw if they maake any plugins to assist with SEO?
    I’m trying too get my blog to rank for some targeted keywords but I’m not seeing very good success.
    If you know of any please share. Many thanks!

    回复 2020年2月26日
  27. バカラ

    My spouse and I stumbled over here coming from a different page and thought I might check things out.
    I like what I see so now i’m following you. Look forward to looking into your web page
    repeatedly.

    回复 2020年2月26日
  28. lexus888 515

    I am truly thankful to the holder of this website who has shared this
    fantastic piece of writing at at this place.

    回复 2020年2月26日
  29. 바카라 사이트

    Thanks for the marvelous posting! I quite enjoyed reading it,
    you could be a great author. I will be sure to bookmark your blog and will often come back down the road.
    I want to encourage you to ultimately continue your great work, have a nice afternoon!

    回复 2020年2月26日
  30. orgno7.wordpress.com

    Excellent goods from you, man. I’ve understand your stuff previous to and you are just too magnificent.
    I actually like what you’ve acquired here, really
    like what you’re stating and the way in which you say it.
    You make it entertaining and you still care for to keep it wise.
    I can’t wait to read much more from you. This is actually a wonderful site.

    回复 2020年2月26日
  31. 예스 카지노

    Hi, I check your blogs on a regular basis. Your humoristic style is witty, keep it
    up!

    回复 2020年2月26日
  32. クイーンカジノ

    Hello there, I discovered your website via Google even as
    searching for a similar matter, your site got here up, it seems to
    be good. I’ve bookmarked it in my google bookmarks.

    Hi there, just become aware of your weblog
    via Google, and found that it is truly informative. I’m going to watch
    out for brussels. I will be grateful when you continue this in future.
    Lots of people might be benefited from your writing. Cheers!

    回复 2020年2月26日
  33. a325 tension control bolts

    I enjoy what you guys tend to be up too. Such clever work and coverage! Keep up the good works guys I’ve you guys to my personal blogroll.

    回复 2020年2月26日
  34. motherfuck

    May I just say what a relief to discover somebody who actually knows what they’re talking about online. You actually know how to bring a problem to light and make it important. More people need to look at this and understand this side of your story. It’s surprising you are not more popular since you certainly possess the gift.

    回复 2020年2月26日
  35. pansy756.design.blog

    Thank you for the good writeup. It in truth was a amusement account it.
    Look complex to far delivered agreeable from you! However, how can we keep in touch?

    回复 2020年2月26日
  36. autosouthafrican.car.blog

    Wow that was unusual. I just wrote an incredibly long comment but after
    I clicked submit my comment didn’t appear.
    Grrrr… well I’m not writing all that over again.
    Anyhow, just wanted to say excellent blog!

    回复 2020年2月26日
  37. 게임 추천

    Hey there just wanted to give you a quick heads up. The text in your content
    seem to be running off the screen in Ie. I’m not sure if this is a formatting issue or something to do with web browser compatibility but I figured
    I’d post to let you know. The design look great though! Hope you get the problem resolved soon.
    Many thanks

    回复 2020年2月26日
  38. arse

    An outstanding share! I’ve just forwarded this onto a co-worker who has been doing a little homework on this. And he actually bought me lunch simply because I discovered it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanx for spending some time to discuss this issue here on your site.

    回复 2020年2月26日
  39. Kimcycle 回复 2020年2月26日
  40. Wuchuangshuiguang.Com

    I do not know whether it’s just me or if perhaps everyone else experiencing issues with
    your site. It appears as if some of the written text on your
    content are running off the screen. Can somebody else please provide feedback and let me
    know if this is happening to them too? This could be a issue with
    my web browser because I’ve had this happen previously.
    Appreciate it

    回复 2020年2月26日
  41. modern rajab maintenance & construction

    Have you ever considered about including a little bit more than just your articles? I mean, what you say is fundamental and all. Nevertheless imagine if you added some great pictures or videos to give your posts more, “pop”! Your content is excellent but with pics and video clips, this blog could certainly be one of the greatest in its niche. Good blog!

    回复 2020年2月26日
  42. クイーンカジノ

    Hi there friends, pleasant article and pleasant urging commented
    at this place, I am truly enjoying by these.

    回复 2020年2月26日
  43. ベラジョンカジノ

    Your style is unique in comparison to other people I have read
    stuff from. Many thanks for posting when you have the opportunity, Guess I’ll just book mark this web site.

    回复 2020年2月25日
  44. 바카라 사이트

    Now I am ready to do my breakfast, when having my breakfast
    coming again to read other news.

    回复 2020年2月25日
  45. 코인 카지노

    Hello, I do think your blog could be having web browser compatibility problems.
    Whenever I look at your website in Safari,
    it looks fine but when opening in Internet Explorer, it has some overlapping issues.
    I merely wanted to provide you with a quick heads up!

    Other than that, excellent blog!

    回复 2020年2月25日
  46. tomatocraft.art.blog

    It’s enormous that you are getting thoughts from this article as
    well as from our dialogue made here.

    回复 2020年2月25日
  47. ass

    Pretty! This has been an incredibly wonderful article. Many thanks for supplying these details.

    回复 2020年2月25日
  48. douche

    Excellent blog you have got here.. It’s difficult to find quality writing like yours nowadays. I seriously appreciate individuals like you! Take care!!

    回复 2020年2月25日