Forum Replies Created

Viewing 15 posts - 26,296 through 26,310 (of 26,487 total)

  • RE: Cannot use column aliases in "Group By" clause?

    But you could do this:

    SELECT SUM(x), 

               case when name LIKE 'Z%' then 'NA' else name end as cust

    FROM foo

    GROUP BY case when name LIKE 'Z%' then 'NA' else name end...

  • RE: SQL syntax

    The challenge did not talk about functions on the left side of the SARG.  Anyone familiar with MS SQL Server knows that if you put a function on the left...

  • RE: SQL syntax

    Actually, syntax does matter.  How DB2 handles the use of functions can be significantly different than how MS SQL Server does.  Yes, with MS SQL Server, it does matter where...

  • RE: SQL syntax

    Unfortunately, that is DB2 syntax.  You have to use T-SQL syntax with MS SQL Server.  Even in your own code you used T-SQL.

    Original post:

    The DB2 equivalent would be:

    select * from...

  • RE: Warehouse... need min and max for each data field per table...

    Since you are using a temp (#) table, change them from a local temp table (#) to a global temp table (##).

    hth

    Lynn

  • RE: SQL syntax

    An update:

    1st, Edwin's query was this:

    Select * From Table

    Where Date(timestamp_column) >= DateAdd(Day, 1, DateAdd(Month, -1, Convert(Char(10), GetDate(), 120)))

    I don't see where you included this query into your test.

    You remind me...

  • RE: SQL syntax

    Using your own terms:

    Challenge met!

    Oh, I get it, if the results don't match what is expected, change the requirements of the challenge!

    I met the requirements, 100000 records in the table.  Pulled...

  • RE: SQL syntax

    Sergiy,

    I took your challenge and created a table (actually 2) with 100000 rows.  I then used 2 queries one using Edwin's method of determining the starting date and one with...

  • RE: SQL syntax

    Sergiy,

    Tactfully pointing out a better way of doing things is one thing.  The way you approached this particular situation was anything but tactful.  Using words like "stupid", '"liar", etc. is not...

  • RE: SQL syntax

    Edwin,

    Personally, I'd rather get it right first then work on enhancing performance.  If doing a date conversion in a query makes it clearer what you are trying to do, then...

  • RE: SSIS Derived column question

    Looking at BOL, you need to but the dd in double quotes: "dd"

  • RE: Changing 2 fields - will I loose data?

    There are several ways to change fields.  In place as was originally provided; using a temporary table; and a third is to add two new columns, copy the data from...

  • RE: Changing 2 fields - will I loose data?

    Just an alternative, and it ensures you don't lose data if that is a concern.

     

  • RE: Changing 2 fields - will I loose data?

    Another alternative to try in development first is this:

    1. Create a new table called tmp_tablename that is identical to your existing table, but with the columns your are changing defined...

  • RE: Left Outer Join while eliminating Duplicates

    Not sure if this will work as advertised, but it is worth a try:

    select

        a.*,

        b.pob_system_date,

        b.pob_company,

        b.pob_site,

        b.pob_po_nbr,

        b.pob_line_nbr

    from

        dbo.SALES a

        left join dbo.PO b

            on (a.company = b.pob_so_company...

Viewing 15 posts - 26,296 through 26,310 (of 26,487 total)