![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am trying to do a correlated update (rather rare condition) because I have unique entries in table 'tylik' which correlate to multiple entries in table 'mylik', in the sense of overwriting the 'c_typ_g' value in table 'tylik' update tylik t set c_typ_g= (select c_typ_g from mylik m where t.c_typ_ylik=m.c_typ_ylik) but I do get a : E_US1401 Scalar subqueries not yet supported in this context. (Tue Mar 15 11:49:07 2011) End of Request - Terminated by Errors this means that it will be supported in the future ? I worked around it by making a procedure which does the overwriting going row by row but it would be cool if this feature would be implemented _______________________________________________ Info-Ingres mailing list Info-Ingres (AT) kettleriverconsulting (DOT) com http://ext-cando.kettleriverconsulti...fo/info-ingres |
#3
| |||
| |||
|
|
Try this update tylik t FROM mylik m set c_typ_g=m.c_typ_g * * *where t.c_typ_ylik=m.c_typ_ylik On 15 March 2011 09:55, nikosv <nikos... (AT) gmail (DOT) com> wrote: |
#4
| |||
| |||
|
|
On Mar 15, 12:56 pm, Peter Gale <pgal... (AT) gmail (DOT) com> wrote: Try this update tylik t FROM mylik m set c_typ_g=m.c_typ_g where t.c_typ_ylik=m.c_typ_ylik gives : E_US125D Ambiguous replace: you have specified several replacements for the same row. (Tue Mar 15 13:05:15 2011) |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Are the m.c_typ_g's in fact ambiguous? *or is there only one m.c_typ_g value per m.c_typ_ylik, but multiple occurrences? Are the m.c_typ_g's in fact ambiguous? |
#7
| |||
| |||
|
|
The error message would indicate that you are running an older version of Ingres. true I am on , II 9.2.0 (int.lnx/118)NPTL |
|
9.3 onwards supports the scalar subqueries though you would probably still need to handle the likely problem of non-uniqueness of mylik - this is why the ambiguous replace messages appear as tylik records would each be potentially updated multiple times. You need to decide which mylik records value will be used to update a given tylik. |
#8
| |||
| |||
|
|
Are the m.c_typ_g's in fact ambiguous? or is there only one m.c_typ_g value per m.c_typ_ylik, but multiple occurrences? Are the m.c_typ_g's in fact ambiguous? yes,for example : c_ylikoy ¦c_typ_ylikl¦c_typ_g +----------+-------- +----------------------------------------------------------- ¦1200003503¦12000035¦38727 ¦1200003504¦12000035¦13380 ¦1200003502¦12000035¦13380 ¦1200003505¦12000035¦13380 L----------+-------- +----------------------------------------------------------- |
#9
| |||
| |||
|
|
So what you are trying to do is ill-defined anyway. |
|
You can still use the temp table intermediate, but you'll have to select some c_typ_g (e.g. min or max) for each c_typ_ylik. Karl |
![]() |
| Thread Tools | |
| Display Modes | |
| |