Forum Replies Created

Viewing 15 posts - 826 through 840 (of 1,228 total)

  • RE: Need help tweaking a random query

    Something like this?

    WITH RandimisedResults AS (

    select CaseNumber, AgentName,

    rn = ROW_NUMBER() OVER (PARTITION BY AgentName ORDER BY NEWID())

    from dbo.CaseSummary

    where CaseDate >= @DateFrom

    and ...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: How to find all customers that has 2 different tickets in order

    SELECT *

    FROM customers c

    INNER JOIN tickets t1 ON t1.CustId = c.CustId AND t1.[subject] = 'info'

    INNER JOIN tickets t2 ON t2.CustId = c.CustId AND t2.[subject] = 'problem'

    WHERE t2.ticketDate >...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Concurrency

    SQLRO (5/20/2011)


    Yes. You are right.

    Paul's article shows an efficient and rigorously tested method for doing this.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Concurrency

    SQLRO (5/20/2011)


    Hi Chris,

    Thanks for the reply.

    The records will not be actually preassigned. The records will be allocated sequentially& dynamically i.e. any top 10 records should be assigned which are...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Concurrency

    Hi Rohit

    This looks like a scheme for selecting and using preassigned numbers for use as identity values in a table - is this the case?

    Cheers

    ChrisM


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: can we use more than one join for 2 tables

    ursfriend77 (5/16/2011)


    SELECT md.number,sd.description from main_data md,sub_data sd

    WHERE 1=1

    AND md.vendor_id=sd.vendor_id(+)

    AND md.inventory_id=sd.item_id(+)

    Here i am using 2 tables main_data and sub_data, as for join rules we have to give n-1 join conditions,...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: How to find average when some of the fields contain null value?

    abhisheksrivastava85 (5/16/2011)


    Thanks a lot for reply man, but it is returning average as 0 when i am using Sign function.

    Check your data and then your code. The method works just...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Insert decimal into varchar, but 2 pos to the left

    SkyBox (5/16/2011)


    That works, but unfortunately the data is for accounting - So rounding is not an option.

    How does the system deal with VAT?

    Is the datatype really varchar? If it is,...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Upgrading a FoxPro db to SQL Server

    Ninja's answered the question you originally posted - it's straightforward enough to write a query which will do what you are asking.

    Expanding upon his comments, you need an intimate knowledge...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Upgrading a FoxPro db to SQL Server

    How confident are you that a column in one table which has a name matching the pk column in another table is a foreign key?


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: SQL Query

    Work on the inner query

    select stud_code,count(*) Num_Absences

    from StudAbsent

    where Absent_date between @StartDate and @EndDate

    and cmpy_code='10'

    group by stud_code

    having count(*) > 2

    until you are certain that the result...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Today's Random Word!

    Ray K (5/13/2011)


    Brandie Tarvin (5/13/2011)


    WOTD: Edited edited

    😀

    :laugh: :laugh: :laugh:


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Order of Tables in a Query

    GilaMonster (5/10/2011)


    terrykzncs (5/10/2011)


    I know that SQL joins tables from left to right, but in what order should we join tables for the code to be most efficient?

    Any order you like....


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Loading dummy data

    Is 29,999,999,997 rows representative of the data you wish to model? Or, with 10 names to start, 99,999,999,990 rows? Is the data itself representative?


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Loading dummy data

    BinaryDigit (5/13/2011)


    thank you, so it doesn't have to be completely different values just that they are unique?

    One or the other will do just fine 😉

    Jeff Moden has a sample data...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

Viewing 15 posts - 826 through 840 (of 1,228 total)