"Query is too complex" exception in MS Access 2010 - sql
The following query is generating an exception.
How can I simplify it?
UPDATE
Word
SET CorrectnessCount=#CorrectnessCount
WHERE GroupNo=#GroupNo AND (Name=#Adduce OR Name=#Assuage
OR Name=#Athwart OR Name=#Auscultation OR Name=#Bedizen
OR Name=#Behoove OR Name=#Benignant OR Name=#Betrothal
OR Name=#Brazier OR Name=#Bungle OR Name=#Callow
OR Name=#Caparison OR Name=#Carillon OR Name=#Caryatid
OR Name=#Catechism OR Name=#Caustic OR Name=#Cavalier
OR Name=#Chagrin OR Name=#Chasm OR Name=#Clamber
OR Name=#Clarion OR Name=#Clavicle OR Name=#Coadjutor
OR Name=#Coax OR Name=#Cockade OR Name=#Coddle OR Name=#Coeval
OR Name=#Comely OR Name=#Condign OR Name=#Confound
OR Name=#Consecrate OR Name=#Continence OR Name=#Contrite
OR Name=#Convalesce OR Name=#Convene OR Name=#Coquette
OR Name=#Cornucopia OR Name=#Cosmology OR Name=#Countervail
OR Name=#Decorous OR Name=#Decry OR Name=#Deference OR Name=#Deft
OR Name=#Desist OR Name=#Desultory OR Name=#Deviant OR Name=#Devout
OR Name=#Disconcert OR Name=#Discourse OR Name=#Disenchanted
OR Name=#Disingenuous OR Name=#Disparage OR Name=#Dispassionate
OR Name=#Dispirit OR Name=#Disposition OR Name=#Disreputable
OR Name=#Divisive OR Name=#Edict OR Name=#Engrossed OR Name=#Enrapture
OR Name=#Entreaty OR Name=#Epicure OR Name=#Epiphany OR Name=#Eponym
OR Name=#Equitable OR Name=#Erstwhile OR Name=#Esoteric
OR Name=#Establishment OR Name=#Eulogy OR Name=#Euphony
OR Name=#Expeditious OR Name=#Expropriate OR Name=#Expunge
OR Name=#Extenuate OR Name=#Extenuating OR Name=#Extrapolate
OR Name=#Exude OR Name=#Facetious OR Name=#Fatalism OR Name=#Fiat
OR Name=#Filch OR Name=#Filibuster OR Name=#Fleece OR Name=#Fleeting
OR Name=#Flummoxed OR Name=#Fluster OR Name=#Flux OR Name=#Foible
OR Name=#Fractious OR Name=#Frieze OR Name=#Fulminate OR Name=#Fusion
OR Name=#Gamut OR Name=#Geomorphic OR Name=#Gratuitous
OR Name=#Gregarious OR Name=#Herald OR Name=#Hermetic
OR Name=#Homonym OR Name=#Hypostatize OR Name=#Ignominious
OR Name=#Immanent OR Name=#Imperative OR Name=#Imperious
OR Name=#Imperturbable OR Name=#Impugn OR Name=#Incredulity
OR Name=#Indigent OR Name=#Ineluctable OR Name=#Inextricable
OR Name=#Intransigent OR Name=#Inveterate OR Name=#Invidious
OR Name=#Irreproachable OR Name=#Lackluster OR Name=#Lull
OR Name=#Luscious OR Name=#Macerate OR Name=#Noisome
OR Name=#Nonplussed OR Name=#Objurgate OR Name=#Pallet
OR Name=#Penitent OR Name=#Plangent OR Name=#Predilection
OR Name=#Presumptuous OR Name=#Quartet OR Name=#Quiescence
OR Name=#Rancour OR Name=#Recalcitrant OR Name=#Recant
OR Name=#Recumbent OR Name=#Recuperate OR Name=#Refractory
OR Name=#Reparation OR Name=#Reprove OR Name=#Repudiate
OR Name=#Repugnant OR Name=#Rescind OR Name=#Resplendent
OR Name=#Restitution OR Name=#Retinue OR Name=#Retort
OR Name=#Retrench OR Name=#Retribution OR Name=#Reveille
OR Name=#Revelry OR Name=#Reverie OR Name=#Rickety OR Name=#Roil
OR Name=#Scurrilous OR Name=#Semblance OR Name=#Sententious
OR Name=#Sequester OR Name=#Simian OR Name=#Sinecure OR Name=#Skein
OR Name=#Skulk OR Name=#Slapdash OR Name=#Slighted OR Name=#Smitten
OR Name=#Smolder OR Name=#Solecism OR Name=#Splenetic OR Name=#Squabble
OR Name=#Staccato OR Name=#Strew OR Name=#Strident OR Name=#Stupor
OR Name=#Surly OR Name=#Tenable OR Name=#Tendentious OR Name=#Tenuous
OR Name=#Termagant OR Name=#Torpid OR Name=#Tort OR Name=#Tortuous
OR Name=#Trenchant OR Name=#Tryst OR Name=#Tumult OR Name=#Uncouth
OR Name=#Vapid OR Name=#Vaunt OR Name=#Vicissitude OR Name=#Vignette
OR Name=#Virulent )
using IN will be better.
UPDATE
Word
SET CorrectnessCount=#CorrectnessCount
WHERE GroupNo=#GroupNo AND Name IN (#Athwart,#Assuage....)
Related
How to change the label name dynamically in vs-tab using vue.js
<vs-tab lable="Kid 1" > <vs-tab lable="Kid 2" > and so on... I made the dynamically add kid and used this like <vs-tab lable="Kid 1" v-for"(kid,index) in kids> I mean this lable="Kid{{index+1}} but showing error plz help me out..
You should replace your code to this: <vs-tab :label="'Kid ' + (index + 1)" v-for"(kid,index) in kids">
And to complete the right answer from #webprogrammer don't forget: for a v-for you need to add a unique key, for instance : :key="index"
Empy list on return
I have this in my qweb report <span t-esc="formatLang(get_routing_data(o)[-1]['total'] , digits=3)"/> it works ok, but sometimes it returns an empty list and then i get error index tuple out of range. how can i avoid it?
You could set the return value of the call to get_routing_data into a variable and make check the value using t-if conditions before use it, like: <t t-set="routing_data" t-value="get_routing_data(o)"/> <span t-if="routing_data and len(routing_data) > 0 and routing_data[-1].get('total', False)" t-esc="formatLang(routing_data[-1]['total'], digits=3)"/>
Laravel DB::update don't working, doing nothing at all, without any errors
I am learning how to run raw SQL queries and stuck at UPDATE operation. I have route for INSERT: Route::get('/insert', function (){ DB::insert('insert into posts (title, content) values (?, ?)', ['PHP with Laravel', 'Just testing']); return 'after insert'; }); And route for SELECT: Route::get('/read', function (){ $results = DB::select('select * from posts'); return var_dump($results); }); After SELECT query I see: /home/pavel/www_mysite/TestLaravel/routes/web.php:31: array (size=1) 0 => object(stdClass)[239] public 'id' => int 11 public 'title' => string 'PHP with Laravel' (length=16) public 'content' => string 'Just testing' (length=12) public 'created_at' => null public 'updated_at' => null public 'is_admin' => int 0 And at least UPDATE query: Route::get('/update', function (){ DB::update('update posts set title = "Nothing here"'); }); After that query the new SELECT query shows the same data and in PHPPgAdmin I found no changes. I installed LaravelDebugBar and may see it at the bottom of the browser at pages for INSERT and SELECT queries, but don't see it at the page for UPDATE query. I cannot realize, where is the mistake.
try to use where clause. example : $affected = DB::update('update users set votes = 100 where name = ?', ['John']);
I tested you code too and it work see this picture
I run your update code on my local environment (laravel 5.2, mysql 5.1). It's updated OK. How about your log?
After some extra research I found that PostrgreSQL may store case-sensitive names of tables and columns. For that case you need to take their names in double quotes in your query. I think that when PostrgreSQL found double quotes in the query - it "thinks" that it is table/column name. But there is no column with those name.
codeigniter change complex query into active record
I have a codeigniter app. My active record syntax works perfectly and is: function get_as_09($q){ $this->db->select('m3'); $this->db->where('ProductCode', $q); $query = $this->db->get('ProductList'); if($query->num_rows > 0){ foreach ($query->result_array() as $row){ $row_set[] = htmlentities(stripslashes($row['m3'])); //build an array } return $row_set; } } This is effectively select 'm3' from 'ProductList' where ProductCode='$1' What I need to do is convert the below query into an active record type query and return it to the controller as per above active record syntax: select length from (SELECT [Length] ,CONCAT(([width]*1000),([thickness]*1000),REPLACE([ProductCode],concat(([width]*1000),([thickness]*1000),REPLACE((convert(varchar,convert(decimal(8,1),length))),'.','')),'')) as options FROM [dbo].[dbo].[ProductList]) as p where options='25100cr' order by length I picture something like below but this does not work. $this->db->select(length); $this->db->from(SELECT [Length],CONCAT(([width]*1000),([thickness]*1000),REPLACE[ProductCode],concat(([width]*1000),([thickness]*1000),REPLACE((convert(varchar,convert(decimal(8,1),length))),'.','')),'')) as options FROM [dbo].[dbo].[ProductList]); $this->db->where(options, $q); $this->db->order(length, desc); Help appreciated as always. Thanks again.
You can use sub query way of codeigniter to do this for this purpose you will have to hack codeigniter. like this Go to system/database/DB_active_rec.php Remove public or protected keyword from these functions public function _compile_select($select_override = FALSE) public function _reset_select() Now subquery writing in available And now here is your query with active record $select = array( 'Length' 'CONCAT(([width]*1000)', 'thickness * 1000', 'REPLACE(ProductCode, concat((width*1000),(thickness*1000),REPLACE((convert(varchar,convert(decimal(8,1),length))),'.','')),'')) as options' ); $this->db->select($select); $this->db->from('ProductList'); $Subquery = $this->db->_compile_select(); $this->db->_reset_select(); $this->db->select('length'); $this->db->from("($Subquery)"); $this->db->where('options','25100cr'); $this->db->order_by('length'); And the thing is done. Cheers!!! Note : While using sub queries you must use $this->db->from('myTable') instead of $this->db->get('myTable') which runs the query. Source
Error creating geography element using "STGeomFromText( 'LINESTRING(..." - SQL 2008
I am getting the following error when trying to create geography elements in sql 2008: NET Framework error occurred during execution of user-defined routine or aggregate "geography": System.ArgumentException: 24200: The specified input does not represent a valid geography instance. System.ArgumentException: Some example queries are: select geography::STGeomFromText( 'LINESTRING( 53.4707 -2.24758,53.4708 -2.25079,53.4733 -2.2597,53.4743 -2.24812,53.4747 -2.24119,53.4756 -2.26244,53.4765 -2.24278,53.4805 -2.28457,53.4909 -2.37892,53.5272 -2.36252,53.7159 -2.56899,53.7165 -2.56208,53.7183 -2.62195,53.7212 -2.55478,53.7439 -2.48239,53.7443 -2.48351,53.7446 -2.48767,53.7455 -2.48894,53.7464 -2.48376,51.5126 -0.22443,51.5126 -0.22455,51.5129 -0.22522,51.5148 -0.22595,51.515 -0.22565,51.5152 -0.22007,51.5153 -0.21982,51.5153 -0.22207,51.516 -0.21593,51.5207 -0.16548,51.5274 -0.13044,51.5287 -0.1195,51.5294 -0.11581,51.5314 -0.114,51.5319 -0.10629,51.546 -0.10225,51.5468 -0.09851,51.5615 -0.09948,51.5618 -0.09859,51.5619 -0.09874,51.5621 -0.09774,51.5622 -0.09793,51.5629 -0.074843,51.5635 -0.07319,51.5638 -0.07423,51.5655 -0.07308,51.5065 -0.23453,51.5098 -0.2346,51.5125 -0.22443,51.5126 -0.22455,51.5141 -0.30077,51.3824 0.219232,51.3832 0.22189,51.3871 0.19381,51.3924 0.19631,51.4505 0.2384,51.4561 0.24682,51.4905 0.26753,51.6112 -0.13568,51.614 -0.1423,51.6149 -0.1279,51.6159 -0.0959,51.6166 -0.08625,51.6827 -0.04306,51.6827 -0.0485,50.8295 -0.135709,50.8336 -0.1389,51.0842 -0.20043,51.2584 -0.12584,51.4889 -0.49628,51.4928 -0.41087,51.493 -0.41909,51.5134 -0.40288,51.5158 -0.40192,51.5169 -0.41292,51.517 -0.41706,51.5171 -0.41794,51.5175 -0.41693,51.5189 -0.41131,51.506 -3.5765,51.5071 -3.57572,51.508 -3.57682,51.5089 -3.57687,51.5094 -3.57552,51.5268 -3.57319,51.5319 -3.57145,51.533 -3.567,51.5537 -2.54326,52.2083 -2.15995,52.2133 -2.15969,52.3653 -2.23896,52.3797 -2.25068,52.3856 -2.24433,52.3856 -2.24637,51.3017 0.14978,51.3168 -0.55901,51.317 -0.55852,51.3179 -0.5572,51.318 -0.55734,51.3714 -0.5076,51.3876 0.50573,51.3881 0.50679,51.3884 0.50491,51.3885 0.505716,51.3951 0.49271,51.3957 0.49308,51.3984 0.45032,51.3998 0.43212,51.423 0.2361,51.4259 0.23944,51.4269 0.24394,51.3017 0.14978,51.3168 -0.55901,51.317 -0.55852,51.3179 -0.5572,51.318 -0.55734,51.3714 -0.5076,51.3876 0.50573,51.3881 0.50679,51.3884 0.50491,51.3885 0.505716,51.3951 0.49271,51.3957 0.49308,51.3984 0.45032,51.3998 0.43212,51.423 0.2361,51.4259 0.23944,51.4269 0.24394,52.2027 0.13072,52.2027 0.13139,52.2041 0.12733,52.2048 0.12558,52.2052 0.124187,52.2083 0.13738,52.2139 0.1106,52.2139 0.1237,52.2146 0.12279,52.2163 0.13467,52.2332 0.07004,52.2374 0.06243,52.3776 -0.25321,52.5366 -0.3223,53.3912 -1.06914,53.5818 -1.21172,53.6173 -1.23025,53.809 -1.34127,54.1533 -1.43958,54.4485 -1.66852,54.7766 -1.57715,54.7777 -1.57547,54.7777 -1.57631,54.7906 -1.53038,54.7934 -1.52982 )' , 4326) or select geography::STGeomFromText( 'LINESTRING( 53.4707 -2.24758,53.4708 -2.25079,53.4733 -2.2597,53.4743 -2.24812,53.4747 -2.24119,53.4756 -2.26244,53.4765 -2.24278,53.4805 -2.28457,53.4909 -2.37892,53.5272 -2.36252,53.7159 -2.56899,53.7165 -2.56208,53.7183 -2.62195,53.7212 -2.55478,53.7439 -2.48239,53.7443 -2.48351,53.7446 -2.48767,53.7455 -2.48894,53.7464 -2.48376,51.5126 -0.22443,51.5126 -0.22455,51.5129 -0.22522,51.5148 -0.22595,51.515 -0.22565,51.5152 -0.22007,51.5153 -0.21982,51.5153 -0.22207,51.516 -0.21593,51.5207 -0.16548,51.5274 -0.13044,51.5287 -0.1195,51.5294 -0.11581,51.5314 -0.114,51.5319 -0.10629,51.546 -0.10225,51.5468 -0.09851,51.5615 -0.09948,51.5618 -0.09859,51.5619 -0.09874,51.5621 -0.09774,51.5622 -0.09793,51.5629 -0.074843,51.5635 -0.07319,51.5638 -0.07423,51.5655 -0.07308,51.5065 -0.23453,51.5098 -0.2346,51.5125 -0.22443,51.5126 -0.22455,51.5141 -0.30077,51.3824 0.219232,51.3832 0.22189,51.3871 0.19381,51.3924 0.19631,51.4505 0.2384,51.4561 0.24682,51.4905 0.26753,51.6112 -0.13568,51.614 -0.1423,51.6149 -0.1279,51.6159 -0.0959,51.6166 -0.08625,51.6827 -0.04306,51.6827 -0.0485,50.8295 -0.135709,50.8336 -0.1389,51.0842 -0.20043,51.2584 -0.12584,51.4889 -0.49628,51.4928 -0.41087,51.493 -0.41909,51.5134 -0.40288,51.5158 -0.40192,51.5169 -0.41292,51.517 -0.41706,51.5171 -0.41794,51.5175 -0.41693,51.5189 -0.41131,51.506 -3.5765,51.5071 -3.57572,51.508 -3.57682,51.5089 -3.57687,51.5094 -3.57552,51.5268 -3.57319,51.5319 -3.57145,51.533 -3.567,51.5537 -2.54326,52.2083 -2.15995,52.2133 -2.15969,52.3653 -2.23896,52.3797 -2.25068,52.3856 -2.24433,52.3856 -2.24637,51.3017 0.14978,51.3168 -0.55901,51.317 -0.55852,51.3179 -0.5572,51.318 -0.55734,51.3714 -0.5076,51.3876 0.50573,51.3881 0.50679,51.3884 0.50491,51.3885 0.505716,51.3951 0.49271,51.3957 0.49308,51.3984 0.45032,51.3998 0.43212,51.423 0.2361,51.4259 0.23944,51.4269 0.24394,51.3017 0.14978,51.3168 -0.55901,51.317 -0.55852,51.3179 -0.5572,51.318 -0.55734,51.3714 -0.5076,51.3876 0.50573,51.3881 0.50679,51.3884 0.50491,51.3885 0.505716,51.3951 0.49271,51.3957 0.49308,51.3984 0.45032,51.3998 0.43212,51.423 0.2361,51.4259 0.23944,51.4269 0.24394,52.2027 0.13072,52.2027 0.13139,52.2041 0.12733,52.2048 0.12558,52.2052 0.124187,52.2083 0.13738,52.2139 0.1106,52.2139 0.1237,52.2146 0.12279,52.2163 0.13467,52.2332 0.07004,52.2374 0.06243,52.3776 -0.25321,52.5366 -0.3223,53.3912 -1.06914,53.5818 -1.21172,53.6173 -1.23025,53.809 -1.34127,54.1533 -1.43958,54.4485 -1.66852,54.7766 -1.57715,54.7777 -1.57547,54.7777 -1.57631,54.7906 -1.53038,54.7934 -1.52982,53.3615 -2.2943,53.3616 -2.29438,53.3619 -2.29431,53.3626 -2.29606,53.363 -2.29748,53.3683 -2.31356,53.3687 -2.31296,53.3967 -2.26766,53.3984 -2.22994,53.481 -2.05105,53.4821 -2.05214,53.4821 -2.11473,53.4827 -2.10573,53.4828 -2.05008,53.4858 -2.05878,53.7633 -2.70157,53.7636 -2.70038,53.7672 -2.70313,53.7952 -2.98557,53.8002 -2.72228,53.8011 -2.71739,53.804 -3.02696,53.8139 -3.05028,53.815 -3.04473,53.8163 -3.05226,53.4707 -2.24758,53.4708 -2.25079,53.4733 -2.2597,53.4743 -2.24812,53.4747 -2.24119,53.4756 -2.26244,53.4765 -2.24278,53.4805 -2.28457,53.4909 -2.37892,53.5272 -2.36252,53.7364 -2.64886,53.7952 -2.98557,53.804 -3.02696,53.806 -2.70331,53.8139 -3.05028,53.815 -3.04473,53.8163 -3.05226,51.401 -0.5297,51.4052 -0.34152,51.4111 -0.300524,51.4126 -0.30176,51.4164 -0.42419,51.4191 -0.41833,51.7152 -0.3928,52.8399 -1.29605,52.8429 -1.29658,52.9216 -1.16451,52.9265 -1.16722,52.9488 -1.1511,52.9489 -1.15012,52.9493 -1.14992,52.9504 -1.14983,52.9509 -1.15128,52.9513 -1.1503,52.9514 -1.15141,52.9517 -1.15273,52.9521 -1.15199,51.502 -0.15932,51.5024 -0.1555,51.5033 -0.14984,51.5033 -0.15075,51.5042 -0.1511,51.5132 -0.16003,51.5134 -0.15871,51.5227 -0.17393,51.5685 -0.2291,51.5712 -0.23129,51.5719 -0.22982,51.573 -0.228,51.5731 -0.22961,51.5763 -0.23571,52.3953 -1.17295,52.6728 -2.07963,53.4061 -2.8963,53.407 -2.90128,53.4075 -2.90136,53.4078 -2.97954,53.4078 -2.9802,53.4078 -2.98228,53.408 -2.98106,53.41 -2.97854,53.4103 -2.90155,53.4103 -2.97767,53.4112 -2.97723,53.4133 -2.96398,53.4143 -2.96216,53.4237 -2.57435,53.4273 -2.91804,51.5033 -0.149834,51.5042 -0.1511,51.5044 -0.14749,51.5051 -0.15035,51.5051 -0.15089,51.5052 -0.15032,51.5056 -0.14872,51.5126 -0.15886,51.5132 -0.1607,51.5179 -0.16725,51.5226 -0.17378,51.5685 -0.22934,51.5686 -0.22953,51.5709 -0.23185,51.5719 -0.23053,52.4003 -1.17515,52.4768 -1.68081,52.6655 -2.06869,53.4062 -2.95647,53.4064 -2.89868,53.4064 -2.95565,53.407 -2.95622,53.4072 -2.95609,53.4075 -2.97961,53.4076 -2.98199,53.4076 -2.98408,53.4084 -2.97404,53.4087 -2.97886,53.4087 -2.98279,53.4092 -2.97452,53.4098 -2.91679,53.4213 -2.54907,51.4871 0.2647,51.4878 0.26815,51.4901 0.26826,51.4931 0.26921,51.4986 0.26975,51.4988 0.25643,51.499 0.25929,51.5001 0.25941,51.5002 0.25852,51.5019 0.26817,51.6053 0.26623,51.6087 0.26389,51.6108 0.26624,51.8917 0.8989,51.8918 0.89627,51.8918 0.89984,51.8919 0.89838,51.892 0.900363,51.8924 0.89627,51.8926 0.86479,51.8926 0.89413,51.8926 0.89605,51.8953 0.8574,51.8966 0.89092,51.5042 -0.08496,51.5051 -0.0844,51.5061 -0.08801,51.5063 -0.08826,51.5108 -0.08656,51.5114 -0.07264,51.5115 -0.07297,51.5119 -0.06908,51.5138 -0.07593,51.5152 -0.07174,51.5161 -0.08162,51.5266 -0.02797,51.5288 -0.01608,51.53 -0.01417,51.5311 -0.01715,51.5927 0.21329,51.5929 0.20981,51.8917 0.8989,51.8918 0.89627,51.8918 0.89984,51.8919 0.89838,51.892 0.900363,51.8924 0.89627,51.8926 0.86479,51.8926 0.89413,51.8926 0.89605,51.8953 0.8574,51.8966 0.89092 )' , 4326) I have many similar queries than run just fine. Can anyone tell me why these particular ones fail? I'm at a loss. Thanks in advance.
I cannot see this from your data, but it seems that you are running into this problem: The LineString instance cannot overlap itself over an interval. It might be useful for you to use the MakeValid() function to correct this.
It was indeed the line overlapping itself. I managed to create a valid geography object using http://sqlspatialtools.codeplex.com/ Great article here: http://blogs.msdn.com/b/edkatibah/archive/2009/06/05/working-with-invalid-data-and-the-sql-server-2008-geography-data-type-part-2.aspx