Speeding up a query

  • You could try something like this:

    INSERT CruiseOffersTmp

    (

    voyageNumber,

    departureAirport,

    duration,

    departureDate,

    availability,

    cabinGrade,

    cruiselineID,

    cruiseshipID,

    bestPrice,

    brochurePrice,

    uploadEntryDate,

    flyCruise

    )

    SELECT

    pt.Cruise_Number,

    pt.Embark_Date,

    pt.Air_City,

    pt.Air_Indicator,

    pt.category,

    am.cruiseLineId,

    pt.Category_Status,

    pt.Best_Price,

    pt.Brochure_Price,

    pt.Duration,

    cgv.ship_code,

    cgv.brand

    FROM Princess1Tmp pt

    INNER JOIN

    CarnivalGroupVoyageDataTmp cgv ON

    cgv.voyage_code = pt.Cruise_Number

    inner join

    amCruiseShips am on

    am.code = cgv.ship_code

    WHERE cgv.brand = 'PC' and am.cruiseLineID = 13

    [edit]

    seeing both on screen at the same time I can see that some of the columns are rearranged but you should get the idea..

    [/edit]

  • Thanks for your help John, the SQL statement does the insert in 12 seconds.

    Good work! 😀

  • Good stuff.. but please check the data is consistent with what you expect.. cheers jd..

  • Yes it is, the only thing I had to do was add distinct to the select statement and of course rearrange some of the columns.

    Thanks again for your help

Viewing 4 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply