This one is weird. And I don't know exactly what I have the ability to provide you for information. Below is the C# code I use to execute a query. And below that is what is ultimately translated and executed. The c# application appears to get hung up and loops. It burns cpu, but never stops. But the same (translated) code will run in seconds if I cut and paste it into Sqlite Expert. I'll keep poking around and see what else I might be doing.
All comments about my syntax are welcome. Have a good one! =========== c# query ============= SQLiteCommand upd_cmd = DbWork.CreateCommand(); //upd_cmd.Parameters.Add(SegmentController.SqlprmDepth); upd_cmd.CommandText = String.Format( @"update {0} set {11} = ( select avg(rowid) from ( select pr.rowid from {1} as m inner join {2} as p on p.{5} = m.{5} and p.{6} = m.{6} inner join {3} as pr on pr.{7} = p.{7} and pr.{8} = p.{9} where {4} = {0}.{4} order by pr.rowid limit {12} ) ) where {4} in ( select {4} from {1} where {10} = {12} ); ", seg.TblNameMatches, seg.ViewNameMatches, seg.ViewNamePools, AddPoolController.POOL_PRIORITIES_TABLE_NAME, SegmentController.SEG_COL_NEEDID, TblZipRoute.ZR_COL_ZIP, TblZipRoute.ZR_COL_CRRT, TblZipRoute.ZR_COL_PRTY, AddPoolController.POOL_COL_POOLID, TblZipRoute.ZR_COL_ID, lvl, SegmentController.SEG_COL_ROUTE_WEIGHT, i ); //SegmentController.SqlprmDepth.Value = i; upd_cmd.ExecuteNonQuery(); } ======= c# query translated ======= update seg_WI_matches set rtwgt = ( select avg(rowid) from ( select pr.rowid from seg_WI_matches_view as m inner join seg_WI_pool_view as p on p.zip = m.zip and p.crrt = m.crrt inner join add_priorities as pr on pr.prty = p.prty and pr.poolid = p.fileid where needid = seg_WI_matches.needid order by pr.rowid limit 1 ) ) where needid in ( select needid from seg_WI_matches_view where CR = 1 ); _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users