RE: [sqlite] Need Help with SQL Statement
Use LIMIT 4 Thanks - Jon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, April 30, 2007 6:10 PM To: sqlite-users@sqlite.org Subject: [sqlite] Need Help with SQL Statement I have a file with the columns: StockSymbol, OptionSymbol, StockPrice, StrikePrice, ExpiryDate For each StockSymbol, ExpiryDate, I would like to list just 4 of the records where the StrikePrice is lower than the StockPrice. The following is close to what I want except it gives me all the rows where the StrikePrice is less than StockPrice but I only want 4 rows (2 PUTs & 2 CALLs) for each Stock and associated ExpiryDate. SELECT StockSymbol, OptionSymbol, ExpiryDate, StrikePrice, StockPrice FROM Options WHERE nStrikePrice < StockPrice ORDER BY StockSymbol,sExpiryDate, nStrikePrice DESC; I would appreciate any suggestions on how I can generate an appropriate SQL statement. Thanks, Roger - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Need Help with SQL Statement
see the LIMIT option On 4/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I have a file with the columns: StockSymbol, OptionSymbol, StockPrice, StrikePrice, ExpiryDate For each StockSymbol, ExpiryDate, I would like to list just 4 of the records where the StrikePrice is lower than the StockPrice. The following is close to what I want except it gives me all the rows where the StrikePrice is less than StockPrice but I only want 4 rows (2 PUTs & 2 CALLs) for each Stock and associated ExpiryDate. SELECT StockSymbol, OptionSymbol, ExpiryDate, StrikePrice, StockPrice FROM Options WHERE nStrikePrice < StockPrice ORDER BY StockSymbol,sExpiryDate, nStrikePrice DESC; I would appreciate any suggestions on how I can generate an appropriate SQL statement. Thanks, Roger - To unsubscribe, send email to [EMAIL PROTECTED] - -- Puneet Kishor http://punkish.eidesis.org/ Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/ Open Source Geospatial Foundation http://www.osgeo.org/education/ - collaborate, communicate, compete = - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Need Help with SQL Statement
I have a file with the columns: StockSymbol, OptionSymbol, StockPrice, StrikePrice, ExpiryDate For each StockSymbol, ExpiryDate, I would like to list just 4 of the records where the StrikePrice is lower than the StockPrice. The following is close to what I want except it gives me all the rows where the StrikePrice is less than StockPrice but I only want 4 rows (2 PUTs & 2 CALLs) for each Stock and associated ExpiryDate. SELECT StockSymbol, OptionSymbol, ExpiryDate, StrikePrice, StockPrice FROM Options WHERE nStrikePrice < StockPrice ORDER BY StockSymbol,sExpiryDate, nStrikePrice DESC; I would appreciate any suggestions on how I can generate an appropriate SQL statement. Thanks, Roger - To unsubscribe, send email to [EMAIL PROTECTED] -