mysql 示列

福尔摩斯对我笑 2018-04-19 11203 次 9943条

该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
未来博客 博主大人
到了这个年纪,不应该再彷徨!

发表评论



 


已有 9943 条评论 1


  1. Japanese Porn

    Hello There. I found your blog the use of msn. That is an extremely neatly written article. I will be sure to bookmark it and come back to learn more of your helpful information. Thank you for the post. I’ll definitely comeback.

    回复 2019年12月11日
  2. ราคาลูกสนุ๊กเกอร์ ซุปเปอร์

    Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you can do with some pics to drive the message home a little bit, but instead of that, this is excellent blog. A great read. I will certainly be back.

    回复 2019年12月11日
  3. search engine optimization

    My brother suggested I may like this website. He was once entirely right. This post truly made my day. You cann’t consider simply how a lot time I had spent for this information! Thanks!

    回复 2019年12月11日
  4. Women slippers

    I’m not certain the place you’re getting your information, but good topic. I needs to spend a while finding out much more or figuring out more. Thank you for great information I used to be searching for this info for my mission.

    回复 2019年12月11日
  5. Myofascial

    Hello! I know this is kinda off topic but I’d figured I’d ask. Would you be interested in trading links or maybe guest writing a blog post or vice-versa? My site discusses a lot of the same subjects as yours and I feel we could greatly benefit from each other. If you might be interested feel free to shoot me an email. I look forward to hearing from you! Fantastic blog by the way!

    回复 2019年12月11日
  6. Bed assembly service

    My brother recommended I might like this blog. He was totally right. This post actually made my day. You can not imagine simply how much time I had spent for this info! Thanks!

    回复 2019年12月10日
  7. women cashmere wrap

    Helpful info. Lucky me I found your website by chance, and I’m shocked why this coincidence didn’t happened in advance! I bookmarked it.

    回复 2019年12月10日
  8. Desk assembly service

    The following time I read a blog, I hope that it doesnt disappoint me as a lot as this one. I mean, I do know it was my option to learn, however I truly thought youd have one thing attention-grabbing to say. All I hear is a bunch of whining about something that you could fix should you werent too busy looking for attention.

    回复 2019年12月10日
  9. dresser assembly service

    Hello, you used to write magnificent, but the last several posts have been kinda boring… I miss your great writings. Past few posts are just a little out of track! come on!

    回复 2019年12月10日
  10. Quick

    Hi there! Would you mind if I share your blog with my facebook group? There’s a lot of folks that I think would really appreciate your content. Please let me know. Cheers

    回复 2019年12月10日
  11. จับ บ่อน การ พนัน รามอินทรา

    What’s Happening i’m new to this, I stumbled upon this I’ve found It absolutely useful and it has helped me out loads. I hope to contribute & aid other users like its helped me. Great job.

    回复 2019年12月9日
  12. house cleaning Las Vegas

    Hi there! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Nonetheless, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!

    回复 2019年12月9日
  13. Furniture assembly help

    I truly enjoy examining on this internet site , it has excellent blog posts. “Do what you fear, and the death of fear is certain.” by Anthony Robbins.

    回复 2019年12月9日
  14. house cleaning Las Vegas

    I was wondering if you ever considered changing the structure of your blog? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having one or two images. Maybe you could space it out better?

    回复 2019年12月9日
  15. Pool table assembly service

    I reckon something genuinely special in this web site.

    回复 2019年12月9日
  16. i99BET

    Good post! We will be linking to this particularly great content on our website. Keep up the good writing.

    回复 2019年12月9日
  17. Tractor Workshop Manuals

    You made some decent points there. I looked on the internet to the issue and located most people is going together with with all your site.

    回复 2019年12月9日
  18. i99BET

    An interesting discussion is definitely worth comment. I do think that you need to write more about this subject matter, it might not be a taboo matter but generally people do not talk about these issues. To the next! Best wishes!

    回复 2019年12月8日
  19. Furniture assembly handyman

    you are really a good webmaster. The site loading speed is amazing. It kind of feels that you are doing any distinctive trick. Also, The contents are masterpiece. you’ve performed a excellent task in this subject!

    回复 2019年12月8日
  20. Furniture installers

    I’ve recently started a site, the information you offer on this site has helped me greatly. Thank you for all of your time & work.

    回复 2019年12月8日
  21. UFABET

    Aw, this was an incredibly good post. Taking the time and actual effort to produce a very good article… but what can I say… I hesitate a lot and never seem to get anything done.

    回复 2019年12月7日
  22. HQ office installers

    I simply had to thank you so much yet again. I’m not certain what I might have made to happen without the actual tips provided by you concerning that area of interest. It became an absolute frustrating case for me personally, but spending time with a new professional technique you managed it took me to jump over fulfillment. Now i’m happier for your help and in addition trust you find out what a great job you are providing training most people thru a site. Most likely you haven’t come across any of us.

    回复 2019年12月7日
  23. Furniture assembly team

    Thanks for discussing your ideas right here. The other matter is that every time a problem develops with a laptop motherboard, individuals should not take the risk of repairing this themselves for if it is not done correctly it can lead to permanent damage to the entire laptop. Most commonly it is safe to approach any dealer of your laptop for that repair of its motherboard. They have got technicians that have an skills in dealing with notebook computer motherboard complications and can get the right diagnosis and undertake repairs.

    回复 2019年12月7日
  24. 스포츠중계

    Can I just say what a reduction to search out somebody who truly is aware of what theyre talking about on the internet. You positively know easy methods to deliver an issue to gentle and make it important. More individuals have to read this and perceive this facet of the story. I cant believe youre no more common because you positively have the gift.

    回复 2019年12月6日
  25. assemblers incorporated

    Somebody necessarily lend a hand to make critically posts I might state. That is the first time I frequented your website page and so far? I amazed with the research you made to create this particular publish incredible. Excellent job!

    回复 2019年12月6日
  26. 3d design

    you’re truly a good webmaster. The site loading velocity is incredible. It sort of feels that you are doing any distinctive trick. Moreover, The contents are masterwork. you’ve performed a great activity on this matter!

    回复 2019年12月6日
  27. udaipur call girls

    It is indeed my belief that mesothelioma can be the most lethal cancer. It contains unusual attributes. The more I actually look at it the harder I am sure it does not work like a real solid tissue cancer. In the event that mesothelioma is usually a rogue virus-like infection, so there is the potential for developing a vaccine and offering vaccination to asbestos exposed people who are vulnerable to high risk with developing foreseeable future asbestos associated malignancies. Thanks for giving your ideas for this important health issue.

    回复 2019年12月6日
  28. togel sgp

    Heya i’m for the primary time here. I found this board and I to find It really helpful & it helped me out a lot. I’m hoping to present one thing again and aid others like you helped me.

    回复 2019年12月6日
  29. moncler jackets

    I抎 should check with you here. Which is not one thing I usually do! I take pleasure in studying a post that may make individuals think. Also, thanks for permitting me to remark!

    回复 2019年12月5日
  30. i99bet

    You are so awesome! I don’t believe I’ve truly read anything like this before. So nice to find another person with some original thoughts on this subject. Really.. thank you for starting this up. This website is something that is required on the internet, someone with a bit of originality.

    回复 2019年12月4日
  31. i99bet

    Pretty! This has been an extremely wonderful article. Thanks for supplying this information.

    回复 2019年12月3日
  32. John Deere Technical Manuals

    Heya! I just wanted to ask if you ever have any issues with hackers? My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to no back up. Do you have any methods to protect against hackers?

    回复 2019年12月2日
  33. air jordans

    There are some fascinating deadlines on this article but I don抰 know if I see all of them heart to heart. There’s some validity but I will take hold opinion until I look into it further. Good article , thanks and we want extra! Added to FeedBurner as nicely

    回复 2019年12月2日
  34. Britt Mantyla

    Greetings! Very useful advice in this particular post! It is the little changes that make the greatest changes. Many thanks for sharing!

    回复 2019年12月2日
  35. Tworzenie Stron Internetowych Gorzow

    of course like your web site but you have to take a look at the spelling on several of your posts. Several of them are rife with spelling problems and I to find it very bothersome to tell the reality nevertheless I’ll surely come again again.

    回复 2019年11月30日
  36. golden goose sneakers

    Can I simply say what a aid to seek out somebody who truly is aware of what theyre talking about on the internet. You positively know the best way to convey an issue to gentle and make it important. More folks must read this and perceive this facet of the story. I cant consider youre not more well-liked because you undoubtedly have the gift.

    回复 2019年11月30日
  37. Nannie Maclaren

    There are a couple of interesting points soon enough in this posting but I don’t determine if I see these center to heart. You can find some validity but Let me take hold opinion until I investigate it further. Good write-up , thanks so we want much more! Put into FeedBurner at the same time

    回复 2019年11月29日
  38. Quinton Backes

    When do you think this Real Estate market will go back up? Or is it still too early to tell? We are seeing a lot of housing foreclosures in Longwood Florida. What about you? We would love to get your feedback on this.

    回复 2019年11月28日
  39. jordan 6

    very nice put up, i actually love this web site, keep on it

    回复 2019年11月27日
  40. Read More Here

    I simply want to mention I’m all new to blogs and actually savored you’re blog site. Very likely I’m likely to bookmark your blog post . You actually come with impressive writings. Thank you for sharing your website page.

    回复 2019年11月24日
  41. curry 6

    I抦 impressed, I need to say. Really hardly ever do I encounter a blog that抯 each educative and entertaining, and let me inform you, you’ve got hit the nail on the head. Your idea is excellent; the difficulty is one thing that not sufficient people are speaking intelligently about. I’m very happy that I stumbled across this in my search for one thing regarding this.

    回复 2019年11月24日
  42. curry 6

    Hiya! I simply want to give a huge thumbs up for the great info you might have here on this post. I might be coming again to your blog for more soon.

    回复 2019年11月21日
  43. air max 2018

    I抎 should check with you here. Which isn’t one thing I normally do! I take pleasure in reading a post that may make individuals think. Additionally, thanks for allowing me to remark!

    回复 2019年11月18日