Gnub Posted March 30, 2007 Share Posted March 30, 2007 I've initiated this query, and it does what it's ment to do, however, it takes over 3 minutes to complete. is there a way to shorten the size of this query? and hopefully shortening the processing time. Need more info, just ask. DELETE FROM dbo.HOTELBEDS_DATABASE WHERE dbo.HOTELBEDS_DATABASE.AIRPORT IN (SELECT HA.IATA_CODE FROM dbo._HOTELBEDS_HOTELS AS HH JOIN dbo._HOTELBEDS_AIRPORTS AS HA ON HH._DESTINATION_CODE = HA.HB_CODE, dbo._HOTELBEDS_BOARDTYPE AS HB WHERE HH._BOARD_TYPE_DESCRIPTION = HB.BOARD_TYPE GROUP BY HA.IATA_CODE ) AND dbo.HOTELBEDS_DATABASE.BOARD_BASIS IN (SELECT dbo._HOTELBEDS_BOARDTYPE.BT_SHORT FROM dbo._HOTELBEDS_HOTELS, dbo._HOTELBEDS_BOARDTYPE WHERE dbo._HOTELBEDS_HOTELS._BOARD_TYPE_DESCRIPTION = dbo._HOTELBEDS_BOARDTYPE.BOARD_TYPE GROUP BY dbo._HOTELBEDS_BOARDTYPE.BT_SHORT ) Thanks in advance -Gnub Quote Link to comment https://forums.phpfreaks.com/topic/44949-need-help-shortening-this-sql-statement/ Share on other sites More sharing options...
fenway Posted April 4, 2007 Share Posted April 4, 2007 It looks like you should probably be able to re-write that as a join... but could you post the explain output of the equivalent select query? Quote Link to comment https://forums.phpfreaks.com/topic/44949-need-help-shortening-this-sql-statement/#findComment-221195 Share on other sites More sharing options...
dough boy Posted April 4, 2007 Share Posted April 4, 2007 Make sure that you have the proper indexes on your table(s). Quote Link to comment https://forums.phpfreaks.com/topic/44949-need-help-shortening-this-sql-statement/#findComment-221448 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.