Update only one select query field
hello
how i can update select query result field in original table.
update table1 set field_1 from(select field_1 from table 1,table2,table3,table4 where table1.field_1=table1.field_1 and table2.field_2=table3.field_2 and table4.field_3=table1.field_4)
like that.is it possible!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!can u please help me to rewrite query/
select query returns result like that from different tables
lets example field_1 field_2 field_3 field_4
TIGER 1 V A
TIGER 2 F B
TIGER 3 R C
I need to update 'TIGER' instead of 'LION' in original table.
THANKS
Maybe something like
update table1
set beast = (select animal
from <table_list>
where <predicates>
where beast = 'LION'when your query returns a single row
or when multiple rows are returned
update (select t1.beast,t2.animal
from (select beast,
<join_columns_list>
from table1
where beast = 'LION'
) t1,
(select animal,
<join_columns_list>
from <table_list>
where <predicates>
) t2
where t1.<join_columns_list> = t2.<join_columns_list>
set beast = animalRegards
Etbin
Similar Messages
-
Joining two tables having no common fields using one select query
Hi Experts,
How to join two tables which are NOT having any field in common using only one select query?
Your help will be appreciated.
Thank you.Identify a third table (or more tables) with common fields with your two tables, or change your question either removing JOIN or removing NO COMMON FIELDS, else you wont get many responses and will be left alone in outer space, as suggested by Thomas.
If you acturally require what you written, better execute two select and merge the two internal tables merging every record from first table with every record of second table, til no more memory is available.
Regards,
Raymond -
LSMW to update only one field in materials
Hello experts,
My requirement is to update only one field 'HRKFT-Origin Group as Subdivision of Cost Element' in material using LSMW. I tried with Standard Batch/Direct Input -> Object - 0020, Method - 0000. But it was not successful as it gave me warning - 'The material cannot be maintained since no maintainable data transferred' at the end.
Now I want to try this using BAPI method in LSMW. But it is showing me error - No target structures could be determined..
Please guide me.
Regards,
Aparna GaikwadHi
i tried the same and am able to do it using LSMW Batch i/p. Object - 0020, Method - 0000.
There in source fields define material, plant and origin grp. in structure relations map the below
BGR00 Batch Input Structure for Session Data <<<< MBEW1 Material COsting
Select Target Structure BGR00 .
BMM00 Material Master: Transaction Data for Batch Input <<<< MBEW1 Material COsting
Select Target Structure BMM00 .
BMMH1 Material Master: Transfer of Main Data <<<< MBEW1 Material COsting
Next in field mapping map those 3 fields: material, plant and origin grp.
while testing do one thing. first take the data and try the same using MM02 manually. if tht is working fine ( i mean if the material is having costing view and you are able to chnage the origin group). then test with the same material, plant and a different origin grp. It will work. -
I am getting dump error while running one report in one select query
Hi,
While running a report program, I am getting a dump error in one select query. So could you please correct the select query so that I can't face the dump error.
SELECT vbeln parvw kunnr INTO CORRESPONDING FIELDS OF TABLE l_t_vbpa
FROM vbpa
FOR ALL ENTRIES IN l_t_backorder_item
WHERE vbeln = l_t_backorder_item-vbeln AND
( ( parvw = c_we AND kunnr IN rng_shipto ) OR ( parvw = c_ag AND
kunnr IN rng_soldto ) ) .
<removed by moderator>
Best Regards,
BDP
Edited by: Thomas Zloch on Apr 30, 2010 12:31 PMHi Bansidhar,
It would be helpful if you could tell what type of dump it is.
If it is a timeout you should check whether l_t_backorder_item is empty - in this case ALL document numbers are selected. f you get the timeout with a populated table consider converting the l_t_backorder_item table into one ore more ranges tables - the select with ranges tables is way quicker than 'for all entries'. But take care the ranges table has not to many entries - the SAP SQL converter puts this into one huge SQL statement and this might become too big to be handled by the database (depends on the actual underlying database).
I would also consider splitting the SELECT into two (2nd one with 'appending into table') to make the code easier to understand It also helps the database system determining a strategy for the select.
Regards,
Gerd Rother -
Access for update only one column in table?
Hi all,
My need is to grant access for update only one column c1 in table t1.
I guess I should use view, could you please give me some example? Maybe other ideas?Hi,
You can grant privileges on individual columns.
GRANT UPDATE (c1)
ON t1
TO grantee_name;Look up GRANT in the SQL language manual. Annoyingly, in recent editions of the manual, GRANT is not indexed, but it's in alphabetic order with all the other statements:
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9013.htm#i2155015 -
Hi all,
I'm working with an 10.2.0.3 Oracle Enterprise version.
I need to create a new user on my database with permission to update only one row on table.
Have you notice if this is possible? In case, how is the grant to do this?
Regards,
dbajugTry this:
SQL> create user usr1 identified by usr1;
User created.
SQL> create user usr2 identified by usr2;
User created.
SQL> grant connect, resource to usr1,usr2;
Grant succeeded.
SQL> conn usr1/usr1
Connected.
SQL> create table t (id number);
Table created.
SQL> insert into t values(1);
1 row created.
SQL> insert into t values(2);
1 row created.
SQL> commit;
Commit complete.
SQL> grant update on t to usr2;
Grant succeeded.
SQL> create or replace trigger trg_t
2 before update on t
3 for each row
4 begin
5 if :old.id>1 then
6 raise_application_error(-22299,'You cant change the specific value ');
7 end if;
8 end;
9 /
Trigger created.
SQL> update usr1.t set id=2 where id=1;
1 row updated.
SQL> update usr1.t set id=2 where id=2;
update usr1.t set id=2 where id=2
ERROR at line 1:
ORA-21000: error number argument to raise_application_error of -22299 is out of
range
ORA-06512: at "USR1.TRG_T", line 3
ORA-04088: error during execution of trigger 'USR1.TRG_T'
SQL> -
Declare the internal table with only one 10 character field and use
Hi,
I want to declare the internal table with only one 10 character field and use.
JayaHi,
Go ahead. U can declare IT with only one field
Example:
data: begin of zcustlist occurs 1000,
custmer(10) type c,
end of zcustlist.
Narendra Reddy.
Edited by: Narendra Reddy C on Aug 8, 2008 11:39 AM -
HT5824 Can I use only one (selected) folder from my documents in iCloud?
Can I use only one (selected) folder from my documents in iCloud for MAC and PC?
If the folders were created in the Photos app on the iPad, they don't really contain copies of the photos. They contain pointers to those photos that allow them to appear in the albums that you create. Consequently, they cannot be imported to the computer. Those albums are for local organization on the iPad only And cannot be imported.
You should be able to select the indicidual phots that you want to import, as far as I know. I can do it on a Mac using iPhoto or Image Capture, so I assume that Windows will allow you to pick and choose which photos you want to import.
Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support -
Select only one type of field using JavaScript in Acrobat X
Looking for a way to select all fields of the same type on a form at once?
Such as selecting all text fields to modify the font type, or all buttons to modify display values. Prior versions 6,7, & 8 were able to do this. Would prefer a script for each control type however I do not see any information in the JavaScript Reference Guide about this.The is no UI for selecting field by type in the newer versions of Acrobat.
Have you looked at the numFields property and example?
With some modification:
function FindFieldType(cType)
var aFieldNames = new Array(); // array of fields of type sFieldType
// walk the array of field names;
for ( var i = 0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
if ( fname.type = cType ) {
// match to field type - add to array of names;
aFieldNames[aFieldNames.length] = fname;
} // end walk array of field names
return aFieldNames;
} // end FindFieldType function
var aMyFields = new Array();
// find button field type
aMyFields = FindFieldType("button");
// now do something with the array of field names;
app.alert("button fields: \n" + aMyFields.join("\n"); -
Internal table with same variable and one select query
Hi,
I am a new bee here with may be a silly question.
I have a internal table as below.
DATA: BEGIN OF IT_ORDERDETAILS OCCURS 0,
VBELN LIKE VBAK-VBELN, "Order number
BSTNK LIKE VBAK-BSTNK, "customer PO
ERDAT LIKE VBAK-ERDAT, " Order created date
MATNR LIKE VBAP-MATNR, "Sales order line item
KWMENG LIKE VBAP-KWMENG, "Quantity
D_VBELN like likp-vbeln, " delivery no
POSNR like lips-posnr, " delivery item
KUNNR LIKE LIKP-KUNNR, "ship quantity
END OF IT_ORDERDETAILS.
Where VBELN field is in VBAK and LIKP table.
VBELN in VBAK table = order #
VBELN in LIKP table is = Delivery #
I want to use join to fetch data in single select query.
Below is the select query
SELECT VBAK~VBELN
VBAK~BSTNK
VBAK~ERDAT
VBAP~MATNR
VBAP~KWMENG
likp~vbeln
lips~posnr
LIPS~VGBEL
INTO (IT_ORDERDETAILSvbak, IT_ORDERDETAILSbstnk, IT_ORDERDETAILSerdat, IT_ORDERDETAILSmatnr, IT_ORDERDETAILSkwmeng, IT_ORDERDETAILSd_vbeln,IT_ORDERDETAILSposnr, IT_ORDERDETAILSkunnr)
FROM VBAK left outer JOIN VBAP ON ( VBAKVBELN = VBAPVBELN )
left outer JOIN LIPS ON ( VBAKVBELN = LIPSVGBEL )
join LIKP on ( LIPSVBELN = LIKPVBELN )
WHERE VBAK~ERDAT IN CR_DATE.
I am getting error in the query.
Please suggest.
Thanks,
RajeshHi rajesh.nayakbola,
although this is not quite the right place for this, let me give you some notes:
1. Code should be
formatted as code
by markin it with mouse and use above <> button.
2. Internal tables shoult not be declared using OCCURS clause - this is last century style
3. Internal tables do not need and should not have a header line, they should use TYPES for declaration
4. Data should not be declared using LIKE: If they refer to dictionary TYPES, use TYPE. LIKE is only mandatory for data objects declared in your program, i.e. DATA IT_some_ORDERDETAILS like IT_ORDERDETAILS.
5. If you get an error here, never write "I am getting error" but copy and paste the error message fully.
- The fields in brackets in the INTO clause never have ~ character, there is no IT_ORDERDETAILS~vbak, only IT_ORDERDETAILS-vbeln
It could be something like this:
TYPES:
BEGIN OF TY_ORDERDETAILS,
VBELN TYPE VBAK-VBELN, "Order number
BSTNK TYPE VBAK-BSTNK, "customer PO
ERDAT TYPE VBAK-ERDAT, " Order created date
MATNR TYPE VBAP-MATNR, "Sales order line item
KWMENG TYPE VBAP-KWMENG, "Quantity
D_VBELN TYPE likp-vbeln, " delivery no
POSNR TYPE lips-posnr, " delivery item
KUNNR TYPE LIKP-KUNNR, "ship quantity
END OF TY_ORDERDETAILS.
DATA:
IT_ORDERDETAILS TYPE TABLE OF TY_ORDERDETAILS.
SELECT VBAK~VBELN
VBAK~BSTNK
VBAK~ERDAT
VBAP~MATNR
VBAP~KWMENG
likp~vbeln AS D_VBELN
lips~posnr
LIKP~KUNNR
INTO CORRSPONDING FIELDS OF TABLE IT_ORDERDETAILS
FROM VBAK left outer JOIN VBAP ON ( VBAK~VBELN = VBAP~VBELN )
left outer JOIN LIPS ON ( VBAK~VBELN = LIPS~VGBEL )
join LIKP on ( LIPS~VBELN = LIKP~VBELN )
WHERE VBAK~ERDAT IN CR_DATE.
Regards,
Clemens -
How to improve the performance of one program in one select query
Hi,
I am facing performance issue in one program. I have given some part of the code of the program.
it is taking much time below select query. How to improve the performance.
Quick response is highly appreciated.
Program code
DATA: BEGIN OF t_dels_tvpod OCCURS 100,
vbeln LIKE tvpod-vbeln,
posnr LIKE tvpod-posnr,
lfimg_diff LIKE tvpod-lfimg_diff,
calcu LIKE tvpod-calcu,
podmg LIKE tvpod-podmg,
uecha LIKE lips-uecha,
pstyv LIKE lips-pstyv,
xchar LIKE lips-xchar,
grund LIKE tvpod-grund,
END OF t_dels_tvpod,
DATA: l_tabix LIKE sy-tabix,
lt_dels_tvpod LIKE t_dels_tvpod OCCURS 10 WITH HEADER LINE,
ls_dels_tvpod LIKE t_dels_tvpod.
SELECT vbeln INTO TABLE lt_dels_tvpod FROM likp
FOR ALL ENTRIES IN t_dels_tvpod
WHERE vbeln = t_dels_tvpod-vbeln
AND erdat IN s_erdat
AND bldat IN s_bldat
AND podat IN s_podat
AND ernam IN s_ernam
AND kunnr IN s_kunnr
AND vkorg IN s_vkorg
AND vstel IN s_vstel
AND lfart NOT IN r_del_types_exclude.
Waiting for quick response.
Best regards,
BDPBansidhar,
1) You need to add a check to make sure that internal table t_dels_tvpod (used in the FOR ALL ENTRIES clause) is not blank. If it is blank skip the SELECt statement.
2) Check the performance with and without clause 'AND lfart NOT IN r_del_types_exclude'. Sometimes NOT causes the select statement to not use the index. Instead of 'lfart NOT IN r_del_types_exclude' use 'lfart IN r_del_types_exclude' and build r_del_types_exclude by using r_del_types_exclude-sign = 'E' instead of 'I'.
3) Make sure that the table used in the FOR ALL ENTRIES clause has unique delivery numbers.
Try doing something like this.
TYPES: BEGIN OF ty_del_types_exclude,
sign(1) TYPE c,
option(2) TYPE c,
low TYPE likp-lfart,
high TYPE likp-lfart,
END OF ty_del_types_exclude.
DATA: w_del_types_exclude TYPE ty_del_types_exclude,
t_del_types_exclude TYPE TABLE OF ty_del_types_exclude,
t_dels_tvpod_tmp LIKE TABLE OF t_dels_tvpod .
IF NOT t_dels_tvpod[] IS INITIAL.
* Assuming that I would like to exclude delivery types 'LP' and 'LPP'
CLEAR w_del_types_exclude.
REFRESH t_del_types_exclude.
w_del_types_exclude-sign = 'E'.
w_del_types_exclude-option = 'EQ'.
w_del_types_exclude-low = 'LP'.
APPEND w_del_types_exclude TO t_del_types_exclude.
w_del_types_exclude-low = 'LPP'.
APPEND w_del_types_exclude TO t_del_types_exclude.
t_dels_tvpod_tmp[] = t_dels_tvpod[].
SORT t_dels_tvpod_tmp BY vbeln.
DELETE ADJACENT DUPLICATES FROM t_dels_tvpod_tmp
COMPARING
vbeln.
SELECT vbeln
FROM likp
INTO TABLE lt_dels_tvpod
FOR ALL ENTRIES IN t_dels_tvpod_tmp
WHERE vbeln EQ t_dels_tvpod_tmp-vbeln
AND erdat IN s_erdat
AND bldat IN s_bldat
AND podat IN s_podat
AND ernam IN s_ernam
AND kunnr IN s_kunnr
AND vkorg IN s_vkorg
AND vstel IN s_vstel
AND lfart IN t_del_types_exclude.
ENDIF. -
Hiding of arrow in JComboBox, only one selection possible
I have a program that I am hitting a database, retrieving data. I have two JComboBoxes. The second box, changes when there is an event associated with the first.
My question is, if there is only one element in the second box, how do I disable the down arrow so that the user can immediately know that the item shown, is the only one that can be selected???
Thanks.Jut call setEnabled(false) and the user will not be able to change the selection. If you want to really 'hide' the arrow, that is a little more complex; it will require modification of the UI delegate.
Mitch Goldstein
Author, Hardcore JFC (Cambridge Univ Press)
[email protected] -
Preview opens multipal photos with only one selected. Suggestions to fix?
When I double click on a single photo in Preview, it opens multipal photos everytime, even though only one is selected.
Tried deleting preview permissions, but preview still opens several photos when only one is clicked.Did you try checking this preference
>System Preferences>General -
Ring tones visible, but only one selectable
I made some custom ringtones using the Ringtones app. These did not appear when selecting Sounds::Ringtone
or individual contacts, so I transferred them to itunes and then dropped them onto my iphone. (I tested them
on the mac: The icons say "RING" and are playable.) They appear in itunes under DEVICES::my iphone::Ringtones
(and of course in Ringtones app). So it looks like they are in the phone. ONE of them appears under Custom when
I select sounds, or ring tones for a contact.
Seems odd that they appear to be on the device, but only one shows up for selection.Hi,
The number of left hand site is the total of all the instances in Active Directory. Including Directory, Access Control namespace and MFA.
Meanwhile, you could refer to this article about removing objects that were synchronized through the Azure Active Directory Sync tool
http://support.microsoft.com/kb/2619062
Regards.
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected] -
Hi,
I have a select query like this.
select vbakvbeln posnr vkorg vbakauart kunnr matnr edatu kdgrp
kvgr3 kvgr4 bsark
from ztsddelividx
inner join vbak on ztsddelividxvbeln = vbakvbeln
inner join tvak on vbakauart = tvakauart
into table rt_delividx
where spart_i = rp_spart and
edatu in ro_date and
vkorg in ro_vkorg and
werks in ro_werks and
matnr in ro_matnr and
ztsddelividx~auart in ro_auart and
kunnr in ro_kunnr and
stgak = c_stgak.
This select query is from a program in production and is working fine. But I want to know from which tables this select query is fetching the fields posnr vkorg kunnr matnr edatu kdgrp kvgr3 kvgr4 bsark .
I checked the Z table ztsddelividx. But to my surprise the fields vkorg kunnr kvgr3 kvgr4 bsark are not there in this Z table.
I want to know from which tables this select query is fetching the fields posnr vkorg kunnr matnr edatu kdgrp kvgr3 kvgr4 bsark .
Thanks in advance.
Brahma ReddyGo for a ST05 trace and check out the select statement that is being executed and built from ABAP open SQL. I hope you will get the solution. By the way, whats the SAP version you are using?
Maybe you are looking for
-
"The email server didn't recognize your username/password combination." This message pops up when trying to send photos from iPhoto via Mail. I have tried reseting passowrds in both gmail and me.com
-
How many ipads can sync to one itunes account?
how many ipads can sync to one itunes account?
-
How do you move imported iMovie events to different drive?
Hi there, I'd like to import my entire iMovie event library (200+ GB) into Final Cut Pro X, but I can't figure out how to get the imported events to live anywhere besides the startup disk. Here's my process so far: Use FCPX's feature to import my ent
-
Which version of firefox for windows ME
Windows ME, older laptop...want Firefox browser but 4.0 does not get past setup.exe
-
I have a fairly functional iMac G4 ( 800 MHz 512MB 75GB HD) which I upgraded to Tiger (10.4.11) several years ago. I also have a iMac G5 (1.8 GHz 512MB 160 GB HD) which is running OS 10.3.9. I'd like to upgrade the G5 to Tiger. Can I use the Tiger