Forum Replies Created

Viewing 15 posts - 331 through 345 (of 1,228 total)

  • RE: SQL Query

    vshiva2379 (7/28/2013)


    Execuse me

    Since you did not understand i how given that data and more over i do not want to disclose my original data i have given that, if...


    [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

    Dird (7/28/2013)


    select name,

    case

    when maths > science and maths > comp then 'maths'

    when comp > science and comp > maths then 'comp'

    else 'science'

    end

    from student

    I think you need another edit...


    [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

    vshiva2379 (7/28/2013)


    Thank you, But Sorry I didnt Get my result with that

    My table is

    Student

    StudentID int,

    name varchar(20),

    maths int,

    science int,

    comp int

    records are

    1, Allen, 60, 80,75

    2, John ,70,60,90

    3, Kim, 86,85, 80

    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: create table valued function

    It's not really possible to tell if a rCTE would return your resultset more efficiently. Can you post the actual query rather than pseudocode? There is a far more efficient...


    [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: Add one MilliSecond to each row

    AndrewSQLDBA (7/26/2013)


    Hello Everyone

    I am trying something, that I am not sure is possible.

    I have a CreateDate column in a table, there are approx 5000 rows with the same date 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: Find integer at end of a string. There *must* be a better solution ?

    thorkil (7/25/2013)


    Hi

    I want to find an integer after a hyphen in a string. If found, then use it. If not, then return -1

    What do you want to do with 123.4?


    [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 can I write this in single select query ?

    prabhu.st (7/25/2013)


    Thanks Guys,

    for reading my post,

    finaly i got it,

    yes,it is possible in the single query, it is..

    select max(item) over()item from my_table where id = 5

    Thanks,

    Prabhu

    No, that doesn't work. It returns...


    [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 can I write this in single select query ?

    prabhu.st (7/25/2013)


    ... CTE, SubQuery,JOINs,Derived Tables,

    All of these are elements of a single query. What do you really mean? If you mean "using a single query and without using any...


    [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: Fuzzy searching

    I've had some good results from this in recent years:

    USE [Matching]

    GO

    /****** Object: UserDefinedFunction [dbo].[IF_Levenshtein01] Script Date: 25/07/2013 10:00:08 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    -- this will score...


    [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: Need urgent help with query

    Can you post up a sample data script please?


    [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: Trying to convert varchar to datetime

    savycara (7/24/2013)


    Actually 2011 is year and 4 is month which shoud be represented as 04 and date is 01 (which is to be added)

    I need this column 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]

  • RE: More efficient way to perform a lookup?

    r_noob (7/15/2013)

    ... ON (A.Field1 like '% ' + B.LookupValue + ' %')

    That looks like words in a sentence. Try Jeff's splitter: split the sentence on space, remove any leading blanks...


    [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: Is there an efficient way to do dynamic sorting within SQL ?

    Break up your cte/derived table chain:

    WITH EMPLOYMENT_OPPORTUNITIES_CTE(

    rownumber, id,title,contactperson,lastmodified,description,workexperiencetypeid,

    workexperience,jobtypeid,AcademicExperienceTypeId,

    industryid,industryid2,industryid3,salaryminid,salarymaxid,

    jobTitle,city,state,PostalCode,positions,deadline)

    AS

    (

    SELECT top 4000 -- top 4000 what? Hair colour? Use ORDER BY or risk random and unpredictable results!

    ROW_NUMBER() OVER (ORDER BY lastmodified DESC)...


    [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: Selecting/Deleting rows with the same column information

    Like 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: How to delete the duplicate row without any unique value? please help

    hydbadrose (4/26/2013)


    Thank you so much and God bless you! TGIF

    You're welcome and Happy Friday to you too!


    [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 - 331 through 345 (of 1,228 total)