Compare and display several column data according to requirement
Hello
I have a requirement where I want to compare the data in two tables and display only the columns if there is a gap using the sql query.
Tell userid, e-mail and phone number of the same employee is stored in two tables. Now, I want to compare data from e-mail and phone number of the two tables and display the e-mail and phone number as if they are different data.
Employee table:
user_id | phone | |
---|---|---|
emp01 | [email protected] | 00200 |
emp02 | [email protected] | 00300 |
emp03 | [email protected] | 00400 |
Table user_details:
ID | user_email | user_phone |
---|---|---|
emp01 | [email protected] | 00201 |
emp02 | (null) | 00300 |
emp03 | [email protected] | 00401 |
Please note that both tables have completely different column names and the data may contain a null as well. What I want to achieve is to compare the same employee data in both tables and display columns that have a different value of user_details table; as:
user_id | user_email | phone |
---|---|---|
emp01 | [email protected] | 00201 |
emp02 | (null) | |
emp03 | [email protected] | 00401 |
As the table column names are different, I can't use a join and less to know the difference. I tried this with the help of CASES after the WHERE clause for comparison of columns multiple but GOLD or AND the two would defy the condition to display all columns with different data for the same line.
How to do this without creating a separate view or a table that I don't have write access? Pointers would be useful.
-Thank you.
No need for something like
You just run
Select k.user_id, k.id,.
e.email, u.user_email,
e.Phone, u.user_phone
of user_key_table k
left outer join
e employee
On k.user_id = e.user_id
left outer join
user_details u
on k.user_id = u.id
the rest is here just to simulate your tables (I don't want to create tables in my APEX Tablespace as there are far too many people already)
Concerning
Etbin
Tags: Database
Similar Questions
-
How to display several column data in an Oracle SQL column
Hello
I have the table t1 and (a1, a2, a3) are columns
I have this request
Select the t1 a1
Union
Select a2 from t1
Union
Select a2 from t1
This is the variant is unpivot, but he calls internal table several times.
I wish in a way, where I want the same output, but the appeal of the table only once.
Thank you
Sunil Jena
Published by: 990324 on March 15, 2013 04:46Assuming a1, a2 and a3 have the same data type:
select case lvl when 1 then a1 when 2 then a2 else a3 end from t1, ( select level lvl from dual connect by level <= 3 ) /
SY.
-
Hello
I had a lot of help from my log of the bus data, previously.
My interest now is to sort them according to certain values of the column and then get an average result of them.
Given that the tiara doesn't seem to support the triage function after loading data, it seems to be a difficult issue for me;
It would be useful that I can get all related index/approach/function/Council to do this kind of script.
I've attached a file excel for example.
In the first "raw" sheet, there are rows of raw data with column names of "year, month, day, ID, ID2, point, condition.
Actual data had many more columns, but I simplified it for convenience.
What I try to do is, with the entry (from DialogBox or simply a script as a variable; I can do this) 'year' and 'months' (e.g.: 2015, 6).
to get the resulting data sheet 'expected results '.
The result is sorted by value 'ID' and 'condition '. 'Condition' is 0 or 1, then the average of the values of 'point' for each ID and the condition is obtained.
Group for the 'condition' of 2 will be the average of the results of the 'condition' 0 and 1 (collection of data). (So there are always three groups: for 'condition', 0, 1, and 2.)
Currently, 'ID' includes 12345 and 54321, but there may be more values, too.
"Num" column is the number of files RAW allows to get the average for the corresponding 'year-month-ID-condition'.
Is there an effective approach or the function that you recommend?
I think that you may need more details for example data, so please do not hesitate to ask me.
Thanks in advance.
Inyoung
The interactive part to modify data in DIAdem is collected in the 'ANALYSIS' left aon tab.
The second entry, 'Functions of channel' contains 'Values of Channel sorting' method.
To automate this process, it is possible to use the macro recorder in the tge script module.
-
Query to retrieve the data according to requirement
Hi team,
I have the table with the details below and my requirement is when I entered the correct empid then only need to display recording (it's easy) and when I entered the empid that is not listed in the table, then I need to display all the records available in this table. Please give me the query.
EmpID ename
7839 KING 7698 BLAKE 7782 CLARK 7566 JONES 7788 SCOTT 7902 FORD 7369 SMITH Kind regards
Anil
can you please mark it as answered@user575819
-
How to load several columns of data into Essbase
Hello!
I need to download a flat in Essbase data file, but this file contains data for each month in a separate column (Jan, Feb and March), it has several columns of data in the source file, while the DATA reversed Essbase data store is a fact with a column of the data table. So I'm stuck on the way in this case to map more than one column of data in the source file to column 1 of the target data.
Thank you very much!When yo reversed your essbase data model in the RKM there will be an option called SEVERAL COLUMNS of DATA (no default value), this must be set to yes. Then, there are 2 other options that need to be addressed DATA_COLUMN_DIMENSION which is the name of the dimension that you load multiple values to in your case period. Then in the next option DATA_COLUMN_MEMBERS specify you a comma list of members separated... column data required i.e. Jan, Feb, Mar etc. Now when you reverse the model, you will have several column data members
-
I use Photoshop elements on Windows 8.1 12. When I go in the Expert Mode to change the available toolbar is displayed in a single column and missing several tools which foreground and background color. How to restore the original toolbar?
Try to re - set preferences.
Go to: Edit > preferences > general (menu Photoshop Elements on Mac)
Click on the button Reset preferences on the next launch
-
How to use several adf 12 shape and insert the form data in to table during the click on "submit" button. Can we use several form from adf or not?
Make sure that you dragged the VO based EO.
Also make sure that the VO attributes based EO Updatable property.
The query according to VO is used only to add LOV to the column of the original VO ModelId.
See you soon
AJ
-
How do I add 7 days to a date and compare it to the current date in a cfquery?
I have classes that are no longer active once after the date of the class. However, the class should be displayed for seven days more in the backend. I tried to use the script below to get there, but I get an error "Variable DATE is not defined." I'm going in the right direction or is there a better way to do this?
< name cfquery = "getClasses" datasource = "#application.dsn #" >
Select *.
(break the classReg INNER JOIN classReg.classID = classes.classID) INNER JOIN instructors ON classreg.instID = instructors.instID
<!-adding seven days to the date of the class (date) by comparing the current date->
where #DateFormat (DateAdd (would be ', 7, date), 'yyyy-mm-dd') # > #DateFormat (now (), 'yyyy-mm-dd') #.
< / cfquery >
where #DateFormat (DateAdd (would be ', 7, date), 'yyyy-mm-dd') # > #DateFormat (now (), 'yyyy-mm-dd') #.
As Coldfusion said you, quite rightly so, he knows no variable called "date". You're in a request and, apparently, 'date' is a column name. So use the SQL functions instead of Coldfusion functions.
In MySQL, the appropriate where clause is:
WHERE DATE_ADD (date, INTERVAL of 7 DAYS) > CURDATE)
In SQL Server, the appropriate where clause is:
WHERE DATEADD(day,7,date) > GETDATE()
---------------------------------
Afterthought: I would rename the column 'date', as it is a reserved word in some database management systems
-
read data from a database and display them in a listbox
Hello
I want to read the data from a table in a database, so I want to display 1 column in a listbox.
I read the data from database, but I can't display in a listbox control.
can someone help me please?
Your VI is way too complicated. If you get a 2D array and you want just the second column, you should only use the Array Index to take off from the second column. That's all.
Once again, the structure of your sequence is completely useless.
I will reiterate my statement about to spend some time with the LabVIEW tutorials.
-
Hi Experts,
JDeveloper 12.1.3.0.0
I have a VO based on entity object. With a column of the VO is transient attribute (I created).
I need to call a stored procedure for each row in the transitional attribute and display the data in the form of af: table. As well as other attributes.
So can anyone suggest how can I achieve this?
Thank you
AR
I think that you need a stored function (which returns the value) in this case, is not?
Take a look at:
https://docs.Oracle.com/CD/B31017_01/Web.1013/b25947/bcadvgen005.htm
and search for:
Invoking stored function with only Arguments in
call your function in the Get attribute and return value accessor...
-
Extraction of XML data and display new line
I have a table named, SAPDATABROWSER, which has several columns and lines. A column named SAPTEXT (data type: CLOB) consist of xml data. Each XML data are different in terms of number of nodes, but has the same following structure:
< SAP_BAPI_PROP >
< SelectedProperty >
< structure >
< field > < / field >
< length > < / length >
< FieldValue > < / FieldValue >
< type > < / Type >
< priority > < / priority >
< / structure >
< / SelectedProperty >
< / SAP_BAPI_PROP >
So now, what I would do is, to extract the values: field, FieldValue and the length of each line (total 72) and see the result as follows.
Length of track FieldValue
XXXX YYYY ZZZZ
PPPP QQQQ RRRR
AAAA BBBB CCCC
MMMM OOOO NNNN
Again, each line (total 72) has several XML Data nodes, IE there are several nodes FieldType, length and field and no two XML data/line are similar!
I use the following code:
SELECT
EXTRACT (xmltype (saptext), ' / SAP_BAPI_PROP/SelectedProperty/Structure/Field / text () ');
EXTRACT (xmltype (saptext), ' / SAP_BAPI_PROP/SelectedProperty/Structure/Length / text () ');
EXTRACT (xmltype (saptext), ' / SAP_BAPI_PROP/SelectedProperty/Structure/FieldValue / text () ')
OF sapdatabrowser;
The code above produces the following result:
SAP_BAPI_PROP/.../Field/Text () SAP_BAPI_PROP/.../Length/text () SAP_BAPI_PROP/.../FieldValue/text)
1 XXXXPPPPAAAA YYYYQQQQBBBB ZZZZRRRRCCCC
2 MMMM OOOO NNNN
Any suggestions? Thank you very much. :)Based on your sample data:
SQL> select x.* 2 from sapdatabrowser t 3 , xmltable( 4 '/SAP_BAPI_PROP/SelectedProperty/Structure' 5 passing xmltype(t.saptext) 6 columns field_name varchar2(30) path 'Field' 7 , field_len varchar2(30) path 'Length' 8 , field_val varchar2(30) path 'FieldValue' 9 ) x 10 ; FIELD_NAME FIELD_LEN FIELD_VAL ------------------------------ ------------------------------ ------------------------------ X Y Z P Q R A B C M N O
(adjust the projected if necessary data types)
-
Field of # of phone and displayed columns.
Hello
I have a few requirements:
1. I have a 'Phone' field in the list applet. I want to have it exact 10 numbers. entry less or more than 10, it must give error.
2. in the list applet, there are five columns. But the right click and 'Display columns' and pressing 'Reset defaults', it should display only four columns.
How can I do?
Kindly help
CherkaouiHello
You are getting this error looks like
SBL-DAT-00399: the expression of query on the field '%1' is not valid. Please review and try again.I presume that you hit this error to the user interface. You validate you are DVM expression? Ensure that its okay.
If you are still encounter this error, try on another field. I worry about the phone # a class forced /bc vanilla constraints field.Thank you
-
A Multiple of a column value and display it as a line
I need to retrieve data from a particular column and display it as a row of data.
For example,.
Table
Col1 col2 col3
1-6-10
1-7-11
1-8-12
2-6-18
2 7 null
2-8-19
The data should be displayed using col 2 as partition as below
col1, col3 col3 col3
1 10 11 12
2 18 19 null
Help, please...Hello
This is called a Pivot . The best wauy to do depends on your version of Oracle. The books following in Oracle 8.1 (or newer)
SELECT col1 , MIN (CASE WHEN col2 = 6 THEN col3 END) AS col2_6_col3 , MIN (CASE WHEN col2 = 7 THEN col3 END) AS col2_7_col3 , MIN (CASE WHEN col2 = 8 THEN col3 END) AS col2_8_col3 FROM t GROUP BY col1 ;
but from Oracle 11, select the following... Function PIVOT is preferable:
SELECT * FROM t PIVOT ( MIN (col3) FOR col2 IN ( 6 AS col2_6_col3 , 7 AS col2_7_col3 , 8 AS col2_8_col3 ) ) ;
To make a pivot, you should know, when you write the query, the number of columns will be in the output. If the number of columns depends on the data in the table at the time of the execution, then you neeed aggregation of chain , as in the previous answers, or dynamic SQL .
Published by: Frank Kulash, April 19, 2011 10:48
Accidentally, answered Pierre. Sorry; I wanted to respond to OP. -
Primary key several columns with Date - parameter problem
All,
I'm having a problem where I can not find the answer to. I looked upstairs and down nothing helps. Help, please.
The issue is that I have a table that has a primary key of several columns and a column is a date, and the other is a string. I have a simple search and I want a picture update of the results table that users can click on and go to another page to update this record. The question is when I launch an appeal based on the updated image, I also want to define the settings based on the record that I have selected. So I put the string parameter and that works very well. The problem is with the date. When I put the setting date this market but he chops off the coast of the timestamp. Later when I try to access this setting "("dateParameter") pageContext.getParameter"; that it will bring a date as December 15, 2008 but I need the whole date and time stamp (i.e., December 15, 2008 10:20:33) to properly identify the record.
Help, please!
Thank you
Colby JHello
because each parameter go into url as a format string, so you will never get the full date with timestamp setting, the solution would be to
1.) set a fire on the photo update action, give his name to the event as "update."
(2.) by clicking Update photograph fires this event.
(3.) processFormrequest in the controller method
OAApplicationModule am = pageContext.getApplicationModule (webBean);
If ("update".equals (pageContext.getParameter ("event")))
{
This will give you the select line when you click UpdateString rowReference = pageContext.getParameter (OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
Line VORowImpl = (EmployeeSummaryVORowImpl) am.findRowByRef (rowReference);
Timestamp sdateVal = (String) row.getAttribute ("Date value");This will transfer the values to the next page
pageContext.putTransactionTransientValue ("transferdvalue", sdateVal);}
and in the next page, you can get the value as follows
timestamp getDateVal = pageContext.getTransactionTransientValue ("transferdvalue" l);
hope this will solve your problem, please let me know if you face any problem
thanx
Pratap -
How to display all the data using several parameters?
Hi all
I used a query as follows to display the data in a report:
Select col1, col2 / / col1 and col2 are columns of tabale tab1
of tab1
where
tab1.Col1 =
(case when: P_COL1 IS NOT NULL then / /: P_COL1 IS a USER SETTING to EQUAL COL1)
: ANOTHER P_COL1 tab1.col1
end)
AND TAB1. COL3 =
(case when: P_COL3 IS NOT NULL then / /: P_COL3 IS a USER SETTING to EQUAL COL3)
: ANOTHER P_COL3 tab1.col3
end)
The problem is when I run the report with the values of parameters or not, it shows the data that is not null for col1 and col3.
That is when the value of col1 or col3 is zero the report would not return this record!
I want the report to show all the data not just the values that is not null.
How to do this?Men,
( :p_col1 is null or ( :p_col1 = tab1.col1 ) ) and ( :p_col2 is null or ( :p_col2 = tab1.col2 ) ) and ( :p_col3 is null or ( :p_col3 = tab1.col3 ) ) etc.
Kurz
Maybe you are looking for
-
I'm moving permanently to the United Kingdom... .should I wait to buy one until I'm there? Concerned about electric current and plug adapters etc.?
-
I lost my license key for an XP Professional OS, how can I get a replacement?
License key for the product replacement Hello! I lost my license key for an XP Professional OS, how can I get another? Thank you!. Dave
-
The computer crashes whenever I put on ' games full screen.
I know it seems immature, but I like to play games on my Windows Vista computer. I've had this computer for about 3 years and rarely have problems with it, at first, I thought it was the screen but when I want to play a game with full screen such as
-
Family and dot net framework 3.5 sp1 update Setup error
Hi all my system is windows vista 32 bit sp1.whenever I use windows update to installIMP updates dot net framework 3.5 sp1 and update family gives x error 0643.After crossing the suggestion given for this error to microsoft, I tried tomanually instal
-
My computer does not connect to my network... !!!
Hi, my Dell laptop (Inspiron 1420) work properly after that only after a certain time he reported that the wireless card will not work correctly. Now, the laptop does not connect to my network more, even with cable LAN, I checked the Device Manager a