Forum Replies Created

Viewing 15 posts - 1 through 15 (of 1,216 total)

  • Reply To: The Order of Operations

    It seems that it is the two operators following each other "/-" that causes unexpected behavior (not the minus at the beginning).

    SELECT -100.0/-100.0*10.0 => 0.1

    SELECT (-1*100.0)/-100.0*10.0 =>0.1

    SELECT -100.0/(-1*100.0)*10.0 => 10

    SELECT...

  • RE: The UPDATE() function

    sipas - Friday, August 10, 2018 3:41 AM

    Not sure about this one - I thought that UPDATE() returned TRUE if an attempt...

  • RE: CASE Statement

    hoseam (11/4/2015)


    '2013-01-01'

    withdrawal_date

    resigned_date

    I want to check, if the member was active during '2013-01-01 and withdrawal_date. Now withdrawal_date can be anything really, it can be '2014-01-05' or '2010-05-02'....

    And I'm using resigned_date...

  • RE: Cross Apply

    Koen Verbeeck (10/15/2015)


    Toreador (10/15/2015)


    The correct answer is that an error occurs, as neither of those tables exists 😉

    The more correct answer would then be: "It depends". 😛

    You are absolutely right....

  • RE: Help with query

    Hi Sharon,

    unless you post the CREATE TABLE statements + INSERT INTO with sample data, it is just groping in the dark....

    However, your PARTITION seems to be incorrect if I understand...

  • RE: t-sql 2012 data stays the same with different parameters

    Hello,

    without DDL of the objects used in this query, and sample data, we can only guess... maybe column Com_House_Final.ItemMonth is not a datetime? Maybe it does not contain any data...

  • RE: Best idea - summary field

    Hello,

    We are supporting a system that has all the main info about each product (quantity onhand, quantity ordered from suppliers, quantity ordered by customers etc.) stored very similarly as described...

  • RE: how to calculate dates difference in a same table

    Hello,

    I think you should try to explain the requirements in more detail.

    "I have a table with appdt as first appointment date and the another record for the same customer# has...

  • RE: Need some help with compliancy calculation

    Solution of Luis seems to me to be the best of the 3 variants. My code has rounding problem (returns 55.55 instead of 55.56), which I overlooked before and only...

  • RE: Need some help with compliancy calculation

    Hi,

    this should do the trick :

    SELECT pgroup,

    CAST(installed as MONEY)/(installed+missing)*100 as percent_installed,

    CAST(missing as MONEY)/(installed+missing)*100 as percent_missing

    FROM (SELECT t5.pgroup, SUM(CASE WHEN t6.state='INSTALLED' THEN 1 ELSE 0 END) as installed, SUM(CASE...

  • RE: SQL Update Query

    You're welcome!

    I noticed you are new... please, next time when you are posting a question, post CREATE TABLE and INSERT statement for sample data on which to test it,...

  • RE: SQL Update Query

    Hm... and what about the 'B' in column FEB ? Is that a typo or correct value?

    In case it is correct value, you need to specify what it means... for...

  • RE: SQL Update Query

    Well, I'm glad it does approximately what you need, but it does not work properly in case where for the same siteID and month you have several rows - in...

  • RE: SQL Update Query

    Phil,

    i may be mistaken, but I understand the reply with "consecutive months" precisely in the way you asked the question 🙂 that is, that there is no overlapping except for...

  • RE: SQL Update Query

    Hi,

    the fact that several rows of the same siteID can have '1' in a column complicates it... here is some simple code that I wrote before I knew of this,...

Viewing 15 posts - 1 through 15 (of 1,216 total)