Forum Replies Created

Viewing 15 posts - 8,326 through 8,340 (of 8,731 total)

  • RE: TSQL to join two tables to calculate the total based on the date range

    This might work, but an index might help even more (if you don't have one). I won't give my advice on the index because I'm learning as well about the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: TSQL to join two tables to calculate the total based on the date range

    Sean Lange (10/16/2012)


    Luis Cazares (10/15/2012)


    But it gives different results, Sean. Because your query will affect how the join is made and will generate duplicates. That's why you need to use...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: TSQL to join two tables to calculate the total based on the date range

    But it gives different results, Sean. Because your query will affect how the join is made and will generate duplicates. That's why you need to use separate conditions for the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: TSQL to join two tables to calculate the total based on the date range

    Sean, for what I understood, he might need to use the original query and filter the rows with a where clause.

    DECLARE @FromDate datetime = '20121013', @ToDate datetime = '20121015'

    SELECT rc.Country,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: replace

    jfdelette (10/15/2012)


    You can try this too :

    update table

    set c1 = convert(int,c1)+convert(int,c2)

    where isnumeric(c1) = 1

    and isnumeric(c2)= 1

    Jeff.

    Why do you insist on converting strings to int when the OP has said that...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: replace

    phamm (10/15/2012)


    Thank you very much. what if my column1 have value 'abcdef0000' and column 2 value is 123. Then I cannot convert them to integer to add them...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: replace

    I don't have SQL in this computer right now, but something like this could solve the issue.

    UPDATE table SET

    column1 = STUFF( column1, LEN(column1) - LEN(column2) -...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: help with difficult situation

    Not like the OP cares much, but here's another option that might not have the best performance, but might be easier to understand for some people.

    By the way, haiao, your...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: help with difficult situation

    Please post your DDL, sample data and expected results based on the sample data.

    It doesn't have to be actual data or the real names of your tables and fields. Just...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: help with difficult situation

    o1548324 (10/11/2012)


    I tried your query but its not returning the right results, it seems like it is stopping after it hits the first records that meets the query conditions because...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: help with difficult situation

    o1548324 (10/11/2012)


    Why not use <= in the bottom phrase?

    Because I'm adding one day to the membership_term_dt. I did this because I don't know the data types of your table....

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: help with difficult situation

    From what I understood you need something like this:

    SELECT a.*

    FROM sales_log_tbl a

    LEFT

    JOIN membership_record_tbl b ON a.member_id = b.member_id

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Reporting using SQL Server

    Take a look at the Stairway for SQL Server Reporting Services (SSRS)

    http://www.sqlservercentral.com/stairway/72382/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: First function Access

    Repeated post. Follow on http://www.sqlservercentral.com/Forums/Topic1371167-392-1.aspx

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Access First() function

    First of all, welcome to SQL Server Central,

    I can see you're new around here and might not be aware of the best way to get help. I recommend you to...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 8,326 through 8,340 (of 8,731 total)