How to include two different tables in view concept..
I have to make the innerjoin between these two tables.. i.e, BUT000-PARTNER = PA0002-PERNR.. here PARTNER is CHAR(10) and PERNR is NUMC(8)..in this i had two probs..one is how to convert this PERNR into CHAR(10) and second is how to match those fields..in VIEWS concept..
regards
ravi..
Kiran,
Usually Views are created where there are two columns of the same type exist in the JOIN CONDITION. In this case your results when you create a VIEW in SE11, you cannot specify the offset so that it considers only the last 8 chars.
So, in this case , you are better off taking care of this in the code, where you can mentiond to consider the first / last 8 chars of the string.
Regards,
Ravi
Note :Please mark all the helpful answers
Similar Messages
-
How to update two different tables by ony one sql query???
Hi All,
i need to update two different talbes in a single sql query..
i m using the following query
UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12
AND
UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
i m getting the following error:
Odbc driver returned an error (SQLExecDirectW).
Error Details
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 17001] Oracle Error code: 936, message: ORA-00936: missing expression at OCI call OCIStmtExecute: UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12 . [nQSError: 17011] SQL statement execution failed. (HY000)
SQL Issued: EXECUTE PHYSICAL CONNECTION POOL writeback UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
but when i m ushin the same query in Microsoft SQL Server it executes properly:
please help me out...There's no valid syntax for this, but there are some tricks you could do to achieve it.
i) You could place an update trigger on TABLE1 to update TABLE2 automatically.
ii) You could define a view across both tables and add an INSTEAD OF UPDATE trigger to it to maintain them.
If I had to do this I'd choose option2, but frankly I'd just be running two updates if it really was me. -
How to connect two different tables from different server?
Dear all expert,
I need to develop a report where i need to connect 2 different tables from 2 different servers. For examples:
BUT000 tables from CRM and KNKK from R3.
Is it possible to do so? Because i try to link these 2 tables together and when i preview the report, it run very slow and sometime it hang. I did not get any result.
Thank You.Moved to SAP Integration kit forum
Appears you are using SAP data sources.
And yes you can but the linked field types must match and be able to be converted into the WHERE portion of the SQL. Click on Database, Show SQL... and see if there is one. If not CR can't figure out how to so it brings all data client side and filters on the second pass.
Thank you
Don -
How to create a foreign key for the table from two different tables?
Hi All,
I have a three table like below. In the below table SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK will be having the primary key for NAME column. The same SAMPLE_CONS3_CHECK table also having the primary key for NAME column and forieign key for SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK tables. See the below code 2
code 1:
CREATE TABLE SAMPLE_CONS_CHECK
(NAME VARCHAR2(10),
SERIES VARCHAR2(5)
CREATE TABLE SAMPLE_CONS2_CHECK
(NAME VARCHAR2(5),
MODEL NUMBER
CREATE TABLE SAMPLE_CONS3_CHECK
(NAME VARCHAR2(5),
MODEL_NO NUMBER
)code 2
alter table SAMPLE_CONS_CHECK
add constraint SAMPLE_CONS_CHECK_pk primary key (NAME)
alter table SAMPLE_CONS2_CHECK
add constraint SAMPLE_CONS2_CHECK_pk primary key (NAME)
alter table SAMPLE_CONS3_CHECK
add constraint SAMPLE_CONS3_CHECK_pk primary key (NAME)
ALTER TABLE SAMPLE_CONS3_CHECK ADD
CONSTRAINT SAMPLE_CONS3_CHECK_FK1 FOREIGN KEY
NAME
) REFERENCES SAMPLE_CONS_CHECK
NAME
) ON DELETE CASCADE;
ALTER TABLE SAMPLE_CONS3_CHECK ADD
CONSTRAINT SAMPLE_CONS3_CHECK_FK2 FOREIGN KEY
NAME
) REFERENCES SAMPLE_CONS2_CHECK
NAME
) ON DELETE CASCADE;From the above schenario i am able to insert the data to SAMPLE_CONS3_CHECK table. But the parent data is already available in the parent table. The problem is here two different constarints from two different tables. While inserting, it is checking from both the tables whether the parent is exist or not.
How can i solve this problem? Can anyone halp me about this?
Thanks
Edited by: orasuriya on Aug 8, 2009 2:02 AMActually the design is completely incorrect.
What you say is
I have
'foo', 'foo series'
'foo','foo model'
'foo',666
By virtue of table3 referring to both table1 and table2.
This means you actually need to have 1 (one) table:
'foo','foo series','foo model', 666
And the 'problem' disappears.
Sybrand Bakker
Senior Oracle DBA -
How can I combine post to two different tables with one form?
I am trying to create a "phantom" record in a table to be used later in a report. How can I create a form and properly $_POST to two different tables? Thanks for any suggestions!
In POST processing, just do the insert to one table, followed by the insert to the second table. I don't understand where you are getting stuck.
Sometimes when we do an insert, we need the auto-generated ID from the newly created record as a "foreign key" for the record created in the second insert. MySQL has a nifty solution for that. The specific code depends on whether you are using the mysql, mysqli or PDO database connection. -
How to compare the contents of two different tables
hello. can somebody give me an idean on how to compare the contents of two different tables in mysql?
example, i have a table named Main List and a table named New List.
The contents of the New List should be compared to the contents of the
Main List, to check if they are equal. I don't have any idea how to manipulate
this data. Hoping for your help. Thanks.it is better to comapre it using java.. try get the resultset first and store that in collections then comapre the two collections
-
How to load data from a flat file to two different tables at a time.
I am not aware of Sql Loader so Please any body suggest me that is there any way to load data from excel sheet to two different tables at a time its very urgent.
with regards,
Srinivas.RRead Utilities Guide from the Oracle Documentation Library. See
<br>
Oracle Database FAQs
</br> -
Selecting data from two different tables.
Do we need to use join two tables with primary/foreign key while trying to use select statement for getting data from those to table.? If no who can i go about do it.
872959 wrote:
If i am using From clause to get data from two different tables, is it necessary that both tables have column of identical data in them.In general, they ought to (or you need to join in a third table that tells you how to map rows from one table to rows of the other table).
It is not strictly necessary that there be any join condition between tables. If you don't provide a join condition, Oracle has to do a Cartesian product. That means that if there are n rows in one table and m rows in the other, the result set will have n * m rows. It is very rarely a good idea to write queries that do Cartesian products but it does occasionally happen.
Justin -
To find Common data in 2 columns in two different tables.
Hi,
Could someone help me out with a querry to find out common data from 2 columns in two different tables??
Thanks
Rajesh966915 wrote:
suppose i hav 2 tables
Table A
s.No name EID
1 aaa 123
2 bbb 234 ... etc..
and Table B
S.no salary eid location
1 mmm$ 123 india
2 ddd$ 556 Uk
3 fff$ 236 US
How do i select the common entry in both the tables??why do you post in forum for SQL & PL/SQL; yet never post anything in either language?
what do you mean by "common enrty"?
does every column value must match exactly across 2 rows in different table? -
Insert same record on two different tables (no master detail)
Hi all,
I'd like to know how to insert 1 record into two different
tables.
the first table is corni_dati the second is cornidati_prev
anytime someone inserts a new record both tables should be
filled.
if ((isset($HTTP_POST_VARS["MM_insert"])) &&
($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO corni_dati (corni_id,
disciplina,
codice_modulo, insegnanti, classi, obiettivi, prerequisiti,
ud1, ud2,
ud3, ud4, ud5, ud6, metodologia, collegamenti, verifiche,
verifiche_note, durata, periodo_inizio, periodo_fine, note,
indirizzo,
modnum, modulo_titolo, `data`, compilato, descrizione) VALUES
(%s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s,
%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['corni_id'],
"int"),
GetSQLValueString($HTTP_POST_VARS['disciplina'],
"text"),
GetSQLValueString($HTTP_POST_VARS['codice_modulo'], "text"),
GetSQLValueString($HTTP_POST_VARS['insegnanti'],
"text"),
GetSQLValueString($HTTP_POST_VARS['classi'],
"text"),
GetSQLValueString($HTTP_POST_VARS['obiettivi'],
"text"),
GetSQLValueString($HTTP_POST_VARS['prerequisiti'], "text"),
GetSQLValueString($HTTP_POST_VARS['ud1'],
"text"),
GetSQLValueString($HTTP_POST_VARS['ud2'],
"text"),
GetSQLValueString($HTTP_POST_VARS['ud3'],
"text"),
GetSQLValueString($HTTP_POST_VARS['ud4'],
"text"),
GetSQLValueString($HTTP_POST_VARS['ud5'],
"text"),
GetSQLValueString($HTTP_POST_VARS['ud6'],
"text"),
GetSQLValueString($HTTP_POST_VARS['metodologia'], "text"),
GetSQLValueString($HTTP_POST_VARS['collegamenti'], "text"),
GetSQLValueString($HTTP_POST_VARS['verifiche'],
"text"),
GetSQLValueString($HTTP_POST_VARS['verifiche_note'], "text"),
GetSQLValueString($HTTP_POST_VARS['durata'],
"int"),
GetSQLValueString($HTTP_POST_VARS['periodo_inizio'], "text"),
GetSQLValueString($HTTP_POST_VARS['periodo_fine'], "text"),
GetSQLValueString($HTTP_POST_VARS['note'],
"text"),
GetSQLValueString($HTTP_POST_VARS['indirizzo'],
"text"),
GetSQLValueString($HTTP_POST_VARS['modnum'],
"text"),
GetSQLValueString($HTTP_POST_VARS['modulo_titolo'], "text"),
GetSQLValueString($HTTP_POST_VARS['data'],
"date"),
GetSQLValueString($HTTP_POST_VARS['compilato'],
"text"),
GetSQLValueString($HTTP_POST_VARS['descrizione'], "text"));
mysql_select_db($database_itiscorni, $itiscorni);
$Result1 = mysql_query($insertSQL, $itiscorni) or
die(mysql_error());
$insertGoTo = "creacodice_doc.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));If you are doing this then you really should have a look at
your database
design. Read up on the first 3 normal forms.
Pat.
"darrel" <[email protected]> wrote in message
news:ee77jg$302$[email protected]..
>
>
> --
>> Hi all,
>> I'd like to know how to insert 1 record into two
different tables.
>
> In your SQL query, just use two inserts:
>
> INSERT into TABLE1...; INSERT into TABLE2...
>
> Darrel
> -
How to add two different page numbers in a single page
How to add two different page numbers in a single page? One is for page number of the whole article, the other one is for page number for each chapter in the article.
It's quite complicated, see
Two Page Numbering Schemes in the Same Document.
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
How to call two different servlet-url in the same application
Hi,
I want to call, consecutively these methods in my application.
response.sendRedirect(servlet-url1)
reponse.sendRedirect(servlet-url2)
but the second method dont answer,
I think, the first method redirect s with response ,
but how to call two different servlet ?
thanksif you call the first redirect, the servlet is getting aborted, so you can redirect to the first servlet, working the stuff in it, and then in the second servlet you can redirect to the third servlet
-
How to Maintain two different prices for same material in different qty?
Dear all,
How to maintain two different prices for same material in different batch quantities in purchase order(ie.,info record)?
(Vendor is supplying quantities in 2 different batches & also in different prices)
Expecting valuable reply.
JeyakanthanIn a PO you can create 2 items, and each item can be maintained with a different price in the conditions.
In info record it is not possible to have different prices for the same period, except for scales.
so if you have a price of e.g. 2 USD for 1000 kg and 1,90 USD for 2000 kg then you can maintain this in scales, but you still have to have 2 items in the PO so that each one can individually find its price.
Alternative you can create contracts (as well with more than one item) to reflect the different prices and batches. -
How to join THREE different tables into internal table using one select statement .
How to join THREE different tables into internal table using one select statement .
Hi experts,
I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
Scenario:
Database tables:
SPFLI
SFLIGHT
SBOOK.
Table Fields:
SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
SEATSOCC_C SEATSMAX_F SEATSOCC_F
SBOOK - CARRID CONNID CLASS
MY INTERNAL TABLE IS IT_XX.
Your help much appreciated.
Thanks in advance.
Pawan.Hi Pawan,
please check below codes. hope it can help you.
TYPES: BEGIN OF ty_xx,
carrid TYPE spfli-carrid ,
connid TYPE spfli-connid ,
countryfr TYPE spfli-countryfr,
cityfrom TYPE spfli-cityfrom ,
countryto TYPE spfli-countryto,
cityto TYPE spfli-cityto ,
fldate TYPE sflight-fldate ,
seatsmax TYPE sflight-seatsmax ,
seatsocc TYPE sflight-seatsocc ,
seatsmax_b TYPE sflight-seatsmax_b,
seatsocc_b TYPE sflight-seatsocc_b,
seatsmax_f TYPE sflight-seatsmax_f,
seatsocc_f TYPE sflight-seatsocc_f,
class TYPE sbook-class,
END OF ty_xx,
t_xx TYPE STANDARD TABLE OF ty_xx.
DATA: it_xx TYPE t_xx.
SELECT spfli~carrid
spfli~connid
spfli~countryfr
spfli~cityfrom
spfli~countryto
spfli~cityto
sflight~fldate
sflight~seatsmax
sflight~seatsocc
sflight~seatsmax_b
sflight~seatsocc_b
sflight~seatsmax_f
sflight~seatsocc_f
sbook~class
INTO TABLE it_xx
FROM spfli INNER JOIN sflight
ON spfli~carrid = sflight~carrid
AND spfli~connid = sflight~connid
INNER JOIN sbook
ON spfli~carrid = sbook~carrid
AND spfli~connid = sbook~connid.
Thanks,
Yawa -
How to join two internal table rows in alternative manner into one internal table?
How to join two internal table rows in alternative manner into one internal table?
two internal tables are suppose itab1 & itab2 & its data
Header 1
Header 2
Header 3
a
b
c
d
e
f
g
h
i
Header 1
Header 2
Header 3
1
2
3
4
5
6
7
8
9
INTO itab3 data
Header 1
Header 2
Header 3
a
b
c
1
2
3
d
e
f
4
5
6
g
h
i
7
8
9Hi Soubhik,
I have added two additional columns for each internal table.
Table_Count - It represents the Internal Table Number(ITAB1 -> 1, ITAB2 -> 2)
Row_Count - It represents the Row Count Number, increase the row count value 1 by one..
ITAB1:
Header 1
Header 2
Header 3
Table_Count
Row_Count
a
b
c
1
1
d
e
f
1
2
g
h
i
1
3
ITAB2:
Header 1
Header 2
Header 3
Table_Count
Row_Count
1
2
3
2
1
4
5
6
2
2
7
8
9
2
3
Create the Final Internal table as same as the ITAB1/ITAB2 structure.
"Data Declarations
DATA: IT_FINAL LIKE TABLE OF ITAB1. "Final Internal Table
FIELD-SYMBOLS: <FS_TAB1> TYPE TY_TAB1, "TAB1
<FS_TAB2> TYPE TY_TAB2. "TAB2
"Assign the values for the additional two column for ITAB1
LOOP AT ITAB1 ASSIGNING <FS_TAB1>.
<FS_TAB1>-TABLE_COUNT = 1. "Table value same for all row
<FS_TAB1>-ROW_COUNT = SY-TABIX. "Index value
ENDLOOP.
"Assign the values for the additional two column for ITAB2
LOOP AT ITAB2 ASSIGNING <FS_TAB2>.
<FS_TAB2>-TABLE_COUNT = 2. "Table value same for all row
<FS_TAB2>-ROW_COUNT = SY-TABIX. "Index value
ENDLOOP.
"Copy the First Internal Table 'ITAB1' to Final Table
IT_FINAL[] = ITAB1[].
"Copy the Second Internal Table 'ITAB2' to Final Table
APPEND IT
LOOP AT ITAB2 INTO WA_TAB2.
APPEND WA_TAB2 TO IT_FINAL.
ENDLOOP.
"Sort the Internal Table based on TABLE_COUNT & ROW_COUNT
SORT IT_FINAL BY ROW_COUNT TABLE_COUNT.
After sorting, check the output for IT_FINAL Table, you can find the required output as shown above.
Regards
Rajkumar Narasimman
Maybe you are looking for
-
I am having an issue where my computer (Window XP Media Edition SP3) will loose all network connectivity after some variable amount of time when my HP Photosmart Premium All In One C309a drivers and software are installed. I cannot access the interne
-
Archive workflow for FCSrv - does it work that way?
Hi, we are installing FCSvr in our shop by the end of the month and after a lot of reading I have a question about an archiving workflow and if that works that way? We have about 1 TB of files each month that are finished productions that need to go.
-
Can't open CS3 docs in CS4.
I can't open an indesign doc made only a year ago. I have tried several but none of my old docs appear to open in CS4. Is there no backward compatibility? I am using the latest update version 6.0.3 557 on Vista x64. ray
-
Good day, I have an SSIS package that uses .csv as a destination. The package is scheduled to run automatically. I would like to dynamically name the files by appending a date stamp. eg. fileX_20140903_001 fileX_20140903_002 fileX_20140903_003 etc. I
-
Remove Personal Domain Problem
Hi. I had a personal domain setup and it was working fine. I recently removed the domain from my .Mac account. iWeb still thinks it is publishing to the domain, and shows the little green indicator light at the bottom with my domain. After it publish