Forum Replies Created

Viewing 15 posts - 376 through 390 (of 1,228 total)

  • RE: ORDER BY non-sequential number sequence

    WolfgangE (1/14/2013)


    ....

    The disadvantages using the cross-apply-method I see are performance and maintenance:

    If the number of rows of the outer select increases the query will slow down as the apply-operator does...


    [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

    Hi Paul

    Your sample data set doesn't have a matching row between MG_VSLVOY_HEADER and MG_VSLVOY_PORT_CONTROL:

    SELECT ncv.*, vh.VSLVOY_HEADER_ID

    FROM NCV_BL ncv

    JOIN MG_VSLVOY_HEADER vh

    ON ncv.saisan_VESSEL_CD = vh.VESSEL_CD

    AND ncv.saisan_VOYAGE_CD = vh.VOYAGE_NUM

    AND ncv.saisan_LEG_CD =...


    [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 BY non-sequential number sequence

    select x.NewSid, sid

    from tbl_xenix

    CROSS APPLY (SELECT NewSid = ('S'+CAST ([statusId] AS VARCHAR(255)))) x

    order by CHARINDEX(x.NewSid,'S5S4')


    [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 Fields that are True

    terrygefael (1/5/2013)


    Hi, Folks! Need help.

    I have a simple table with 29 fields(unique id, 14 True/False, 14 text)

    I want to find all fields relating to one unique ID that are true.

    Example:

    SELECT...


    [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: Using Results from one column to calculate another column

    Use CROSS APPLY.

    SELECT

    x.Results1,

    CASE WHEN x.Results1 > 42 THEN ...

    FROM ...

    CROSS APPLY (SELECT... VERY LONG FORMULA as Results1) x

    WHERE x.Results1 =...


    [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 get join not duplicate?

    Read the link in my sig (please read this) to see how to generate and post readily-consumable sample data. If folks can get to work on your problem using cut-and-paste...


    [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: help with this query!!!!

    Where in this code do you populate table #sid?

    sqldba_newbie (10/28/2012)


    My goal here to apply the condition to the query while joining the table instead of doing it at the end....


    [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: Using the "IF" function in a column

    jrichards54 (10/28/2012)


    Is it possible to use the "IF" function in a column at design time as the value for that field? I do it regularly in Excel with no problem...


    [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: Are the posted questions getting worse?

    L' Eomot Inversé (10/27/2012)


    L' Eomot Inversé (10/26/2012)


    WayneS (10/25/2012)


    Anyone still alive out here? 3 days with no comments... that has to be a record for The Thread.

    Some malware has reduced my...


    [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!

    Revenant (10/27/2012)


    crookj (10/26/2012)


    Brandie Tarvin (10/26/2012)


    Rat

    Ben

    MJ song

    MJ brownies


    [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: Loop through table to group associated records

    scarlam (10/24/2012)


    Any ideas on how to go about writing a script or stored procedure that can loop through this table.

    You're a programmer, you work to a specification -...


    [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: Extracting Data from single table

    dthmtlgod (10/15/2012)


    I only want the records with a 1 and not a 5 status

    ;WITH SampleData (TICKET, [STATUS]) AS (

    SELECT 9543, 1 UNION ALL

    SELECT 9543, 5 UNION ALL

    SELECT 9543, 5 UNION...


    [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 do I join tables, but select top 1 from 1-many tbl?

    Don. (10/28/2012)


    ChrisM@home (10/28/2012)


    Thanks for the feedback, Don. The script in bold - is it the 2000-compatible one?

    Morning Chris,

    It was the following script you gave me help with:

    SELECT c.*, h.* ...


    [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 do I join tables, but select top 1 from 1-many tbl?

    Don. (10/28/2012)


    ChrisM@home (10/17/2012)


    Eric M Russell (10/15/2012)


    If Don has time, it would be interesting to know how this triangular join method compares to the aggregate methods. With small partitions it could...


    [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: Suggestion to avoid Cursor

    -- if this returns a few thousands of rows or more;

    SELECT RTRIM(referencia) referencia FROM arttamcor GROUP BY referencia

    -- then consider setting it up as a temp table:

    SELECT RTRIM(referencia) referencia

    INTO...


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