Query to solve
I have employee table and salary table.
Employee table
Empno ename
101 a
102 b
103 c
Salary table
empno salary ename
101 50000
102 60000
103 40000
Now i want to update ename in salary table.Ename should be ename of employee table for the corresponding
Empno in salary table.
for ex after update in salary table
salary table should be like this
empno salary ename
101 50000 a
102 60000 b
103 40000 c
Pls give querys to solve.
If it is homework its a terrible example as its denormalising the data. That should probably should be your answer. However, if you really want to do this, try:
UPDATE salary a
SET a.ename = (SELECT b.ename
FROM employee b
WHERE b.empno = a.empno)
WHERE EXISTS (SELECT 1
FROM employee c
WHERE c.empno = a.empno)
Similar Messages
-
Query problem(solved)
hi frs,
i want to display work_location and office_location in a report.which is in table
HR_LOCATIONS_ALL
Which has two location_id
work location : location_id from per_all_assignments_f &
office location: location_id from hr_all_organization_units
how to get both i a have attached the query what i have created but not getting correct values
Thanks
Rajesh
Message was edited by:
Rajesh.mani
Message was edited by:
Rajesh.maniWhat Sarma is basically implying is that we do not care if your problem is an urgent one.. as we, the forum, do not get paid to solve problems here. Forum members assist people in their free time. So why should we care if your problem is urgent? You are in no position to demand a quick response from us.
Also, by saying that your problem is urgent, you are also saying that other people who have posted problems here, have less urgent and important problems than you. That you and your problem are special and more important than anyone else in this forum.
Neither of these are acceptable - which is why using the word "urgent" in a posting to a public forum staffed by volunteers, is not acceptable. -
Could you anyone plz send query to solve
Hi
i hav a table name student,three columns math,phys,chem 3 subjects name,
student a,b,c,d,e,f.... ok. here ram,sham,jadu etc.
i need to get those student's name with subject and marks
who have scored height mark with respect to.
i need sql query to find out result
previous one was just hints, according to my requirement
Hint:
answer would be like:
ram phys 80
sham math 85
jadu chem 82
table like:
name phys chem math
ram 80 73 71
sham 75 73 85
jadu 72 82 73
mac 74 78 67
jan 78 56 65
han 56 45 76
Edited by: Sujay S on Oct 10, 2009 12:00 PMTable: HighestMarks
Stname Phy math Chem
Aseet 50 64 90
Rabi 80 96 34
Pravat 57 95 90
Sankar 80 60 45
Query:
select t1.stname, decode(t2.m_p,t1.phy,'phys',decode(t2.m_c,t1.chem,'chem','math')) subject
,decode(t2.m_p,t1.phy,phy,decode(t2.m_c,t1.chem,chem,math)) marks
from HighestMARKS t1,
select max(phy) m_p, max(chem) m_c, max(math) m_m from HighestMARKS t1
) t2
where t1.phy=t2.m_p
or t1.math = t2.m_m
or t1.chem = t2.m_c
Error:
1. if a single person secure highest marks in two subjects(Pravat secure highest mark in Math and Chem) then this query shows 2 subjects .It does not show the highest mark in Math
Stname Subjects Marks
Aseet chem 90
Rabi phys 80
Pravat chem 90
Sankar phys 80
But if 2 person secures same highest mark then this query returns results.
Edited by: Sujay S on Oct 10, 2009 3:04 PM -
Need sql query to solve the problem?
Hi,
My table contains data which is mentioned below:
Region
Country
DeviceType
Brand
ModelExt
AttributeGroup
AttributeType
AttributeValue
NULL
NULL
A/V Receiver
Sony
STRD560Z
Input keys order
Input Key name on control panel_key order
Asdfg.1.1
NULL
NULL
A/V Receiver
Sony
STRD560Z
Input keys order
Input Key name on control panel_key order
Input.TV
NULL
NULL
A/V Receiver
Sony
STRD560Z
Input keys order
Input key Name on Display_key Order
ASDFG.1.in
NULL
NULL
A/V Receiver
Sony
STRD560Z
Input keys order
Input key Name on Display_key Order
Input.Tv.IN
NULL
NULL
A/V Receiver
Sony
STRD560Z
Input keys order
Input key Name on Display_key Order
RTYU.1
And i need O/p like
Region
Country
DeviceType
Brand
ModelExt
AttributeGroup
Input Key name on control panel_key order
Input key Name on Display_key Order
NULL
NULL
A/V Receiver
Sony
STRD560Z
Input keys order
Asdfg.1.1
ASDFG.1.in
NULL
NULL
A/V Receiver
Sony
STRD560Z
Input keys order
Input.TV
Input.Tv.IN
NULL
NULL
A/V Receiver
Sony
STRD560Z
Input keys order
RTYU.1
Please help. Req. is urgent.
Regards,
PuneethYou can use the CASE expression to pivot the AttributeType column.
Examples for CASE expression usage:
http://www.sqlusa.com/bestpractices/training/scripts/casefunction/
A second possibility is the PIVOT operator:
http://technet.microsoft.com/en-us/library/ms177410(v=sql.105).aspx
Instead of the COUNT or SUM operators, use MIN or MAX operators.
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014 -
Multi-Currency Customer Receivables Aging Query
Hello Everyone,
SAP B1 2005 SP 01 PL 42
We cannot produce customer statements for multi-currency accounts (CND & USD) through the Customer Receivables Aging report. The report converts all FC to LC which is not useful to the customer.
The statement must show the open invoices in USD and open invoices in CND so that the customer can pay in the appropriate currency.
We are attempting to create a query to solve this issue and assign a PLD to execute the calculations, but cannot see the best way to execute the task.
The customer account balance (displaying only unreconciled tans.) would be the most reliable data set (form 809), but it is not available as a table in the query manager. Any other table suggestions?
We would like to avoid building the query from scratch (collecting all open invoices, credits, payments etc...) to avoid error. We would also like to avoid exporting the data as this is very time consuming. Any suggestions?
Thanks in advance,
TamaraWe have found it better to set up two customers where different currencies are transacted - one in each currency. That way you can produce a statement in each currency.
I know it's not a perfect solution, but a good work around?
The only way to get the data you need would be to use OJDT and JDT1 tables, but you would need to join to the reconciliation table as well (OITR?) to get open transactions. -
Hi
I have Pure SQL DataBase name of Table as per given Coloumn Name.
User Name StartDate EndDate
Mr.Jack 01/04/2010 05/04/2010
Mr.Perlin 07/04/2010 10/04/2010
Mr.Tinklin 01/05/2010 05/05/2010
Mr.Kerlin 12/04/2010 15/04/2010
Now I am using asp.net Form Using C#...
Name --> TextBox
StartDate -> TextBox
EndDate --> TextBox
Now User enter the Dates after Click Save Button....
Here SQL Query Check Whether the User Dates Clause into Data Base Date's.
For Examble..
User Enter Start Date = 04/04/2010, EndDate =08/04/2010
Now Query it check SQL DataBase, Already 01/04/2010 to 10/04/2010 Available so Dont allow Save.... only allow various dates...
---------------- This is task Condition -------
i am using SQL Query
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate ='02/04/2010' --// This is User Start Date coming from Text Box
SET @EndDate = '10/04/2010' --// This is User End Date coming from Text Box
IF NOT EXISTS (SELECT PollID FROM Polls WHERE (StartDate<= CAST (CONVERT(VARCHAR,@StartDate,101) AS DATETIME) OR EndDate <= CAST (CONVERT (VARCHAR,@EndDate,101) AS DateTime)) AND STATUS<>'D')
SELECT 'OK ALLLOW'
ELSE
SELECT 'NOT ALLOW'
But it is not working Correctly....
Pls give some correctful query for solve task Condition
By
Riyaz
Edited by: 798225 on Sep 28, 2010 10:37 PM
Edited by: 798225 on Sep 28, 2010 10:52 PMNow I am developing Polls Application in asp.net
I am using Polls Concept,
DateBase Name : Polls
Fields : PollID PollName StartDate EndDate UserID
In Asp.Form Having
User Name : TextBox
PollName: TextBox
StartDate: TextBox
EndDate: TextBox
Submit - Button
Task Details
Whenever User Click after fillup all data's... then SQL Query Check
if StartDate or EndDate is exists in Between DataBase Date's.....
Condition true means dont allow save.. else Save.....
Examble:
PollID PollName StartDate EndDate UserName
01 Sample 23/09/2010 26/09/2010 Klit
02 Sample 2 29/09/2010 30/09/2010 Jack
Now User given follwing details and click Submit,
User Name : James
PollName: Test
StartDate: 22/09/2010
EndDate: 27/09/2010
Submit - Button
Here User StartDate: 22/09/2010 , EndDate: 27/09/2010
SQL Query Check ,
Condtion 1 : Those dates are avilable in Datebase???
Result: Yes
Because, Sample Poll date is 23/09/2010 to 26/09/2010, here Start Date is Not Exists, But End Date Exists.
So dnt allow Save Operation....
Now User Again given follwing details and click Submit,
User Name : James
PollName: Test
StartDate: 27/09/2010
EndDate: 28/09/2010
Submit - Button
Here User StartDate: 27/09/2010 , EndDate: 28/09/2010
SQL Query Again Check ,
Condtion 1 : Those dates are avilable in Datebase???
Result: No
Because, Sample Poll date is 23/09/2010 to 26/09/2010,
Sample1 Poll Date is 29/09/2010 to 30/09/2010
here Start Date is Not Exists, But End Date Not Exists.
So Allow Save Operation....
This a My Task....
Could You give SQL Query for help to Check given condition??
regd
Riayz
Edited by: Riyaz on Sep 30, 2010 1:08 AM -
Query to insert a row in a table with same values except 1 field.
Suppose I have a table with 100 columns(fields).
I want to insert a row with 99 fileds being the same as previous ones except one fileld being different.
The table doesn't have any constraints.
Kindly suggest a query to solve the above purpose..And for much more lazy people, a desc of table is shorter to write. :-)
Then copy & paste into any editor, then mode column to add a comma after every column name in one shot.Or have the system do it for you. Be lazy.
SELECT Column_Name || ',' FROM User_Tab_Columns where Table_Name = '';
Indeed, it can be converted to a script called desc(.sql)
SELECT Column_Name || ',' FROM User_Tab_Columns where Table_Name = '&1' ORDER BY Column_Id;
Then desc or @desc. -
SELECT QUERY CHECK & WHERE CLAUSE DIFFERENCE.URGENT PLEASE.
My question is ,
IF SBOOK_WA-CARRID = 'LH' CONDITION IS AGAIN PRESENT IN THE DATABASE TABLE ,,,,WILL THE CHECK CONDITION SEARCH IT AGAIN EVEN AFTER FINDING IT IN THE FIRST OF THE TABLE???OR SIMPLY TERMINATE IN THE FIRST TIME THE CONDITION SATISFIES??IF DOES TERMINATE THEN ERRONEOUS RESULT IS BOUND TO COME SINCE ONE MORE RECORS IS UNSELECTED.
SIMILARLY DOES THE WHERE CLAUSE CONTINUE SEARCHING EVEN AFTER HAVING FOUND THE CONDITION ALREADY ONCE IN THE TABLE??
PLEASE HELP ME IN THIS ASPECT.PLEASE CHECK THE TWO DIFFERENT CODES & ANSWER ACCORDINGLY..
SELECT * FROM SBOOK INTO SBOOK_WA.
CHECK: SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
ENDSELECT.
SELECT * FROM SBOOK INTO SBOOK_WA
WHERE CARRID = 'LH' AND
CONNID = '0400'.
ENDSELECT.Hi,
The Check condition will be true, so it will not going to display the records, it will fill the internal table.
In the Where condition it will fill the Internal table as well as it will display also.
Hope now your query is solved
Regards,
Dhruv Shah -
Commission report Query Question
The inbuilt Commission Report is run by the following query:
SELECT T0.DocNum, T0.DocType, T0.DocTotal, ( T0.DocTotal - T0.VatSum) As "Net Income" , T1.SlpName, T1.Commission, ( ( T0.DocTotal - T0.VatSum)*( T1.Commission/100)) As "Sum_Commissions" FROM OINV T0 INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode WHERE T1.SlpName = N'[%0]' AND T0.DocDate >= '[%1]' AND T0.DocDate <= '[%2]'
However, I have a need to change this query to solve a problem:
If AFTER the Invoices are added to the system, I go back to the Invoice and change/add the Employee Name to the transaction line, the query ignores these additions made. Can I change the query so the Commission Report takes into account changes made to the employees' field AFTER invoices are posted to the system (SAP allowes me to make such changes to the employee)
In other words I would like the Query to look at the Emploee field AFTER I make changes and give me an updated report.
i am aware that SAP does not allow changes to the Invoice AFTER posting them to the system but it seems to allow changes to the Commission/Employee field, so I should be able to run a Commission report after I make these changes.
Thank you
RobertHi SUDA,
Yes I mean SALES EMPLOYEE. It seems strange to me as well that this report will ignore the information in this field. I have checked this again and what seems to happen is as follows: Say I have invoice no 712 marked to Employee=Erica and I run the commission report for Erica and invoice 712 correctly appears on the report. Then I go back and change the Employee Name on the Invoice 712 (on each line) to Robert and I run the report again. I would expect that Inv 712 will be included in this report (commission report for Robert) but for some strange reason, IS NOT.
In fact INV 712 is still associated with ERICA although I have changed the SE to Robert- please check this out?
Thanks
Robert -
IGMP Querier with Bluecoat ProxySG
Hi all
I ran into a problem with VIP for high availability on Blue Coat ProxySG. Both ProxySG send multicast packets
to advise the other ProxySG that it is up and the priority is contained in the multicast packet, along with the IP address of the VIP and so on.
This worked fine with Catalyst switches. Unfortunately it does not work over the newly installed Nexus switches.
There is no Vlan interface on the switches. The Vlan is only trunked through.
I found a hint that IGMP Querier could solve this issue. After configuration of IGMP Querier end acitvating Multicast on ProxySG
a IGMP group is built and all seems fine.
In a trace I can see IGMP Queries leaving the Querier but no answer from both ProxySGs.
After 6 minutes (3 times Querier Interval) the group disappears and both Boxes become active.
The topology looks like this:
Bluecoat1 -----N2k------2*N5k-----2*N7k-------Inter Datacenter Link-------2*N7k------2*N5k-----N2k-----Bluecoat2
vPC vPC vPC vPC
On both N7k in the left Datacenter is a Querier configured:
vlan configuration 85
ip igmp snooping querier 10.101.22.7
# sh ip igmp snoop querier
Vlan IP Address Version Expires Port
85 10.101.22.7 v3 00:01:22 Switch querier
I wonder if an additional setting has to be made. Could it be that the Bluecoats ignore IGMPv3?
I would be very grateful for a hint.
Many Thanks!
Regards,
UrsHi,
I am exeperiencing the same issue described above, with a similar network layout:
BlueCoat1---N2K---2*N5K(vPC)---2*C6880(VSS)---Inter Datacenter Links---2*C6880(VSS)---2*N5K(vPC)---N2K---BlueCoat2
I have configured an IGMP querier in the BlueCoat VLANs on both 2*N5K(vPC), even if on one 2*N5K(vPC) should be enough.
For each VLAN I've used the same free IP-Address on all 4 N5K:
Is that correct?
I am asking, bacause the Cisco-documetation says, that only the one with the "lowest IP-Address (?)" will be active:
How should the IGMP-Querier-election work in my case?
Any help will be really appreciated.
Many thanks -
Here's my problem...
I have a table that I am using for a forum. I have the following fields in table...
username
datepost
post
postby
subject
Whenever somebody posts a new topic - a new record with a new subject is created. Whenever somebody responds to a post - a new record with an already existing subject is created - anotherwards I am grouping the records by subject so when a user views a topic the original post will display and all responses will display by setting the query to "select * from .... where subject like ...."
My problem is on the forum home page I have a table and I want to set the query to display all the subjects, but only once...anotherwards for each subject I just want to display the oldest record because that record will be the original post and yes datepost is type DATE/TIME in MySQL. I know that I could add a field to this table and do something like everytime a new topic is posted set the new field to 1 and then set all replies to set the new field to 2 and then I could just use this new field in the query to solve my problem, but I DON'T WANT TO ADD A FIELD TO THE TABLE. So does anybody know how I can solve this problem without changing the table?
Thanks in advance.I wonder if my forum etiquette is wrong or something because alot of my posts go unanswered, but either way I solved my problem. I did end up making a new table fields follow...
screenname varchar
date date/time (MySQL Date/Time)
topic varchar
originator varchar (probably should be boolean to be most efficient and follow best practices, but I was lazy!)
post text
notes text (Really just an extra field for admin use)
forumid varchar
Here's how it works...
originator field is updated with char 1 for an originating post...anotherwards when a new topic is created that record gets a 1 in this field...The reason I do this is so when somebody wants to view a post I have to identify one of the records as the originating post and I also need a way to query for only unique topics that are originating post so all replies get char 0 in this field. Now when a client goes to forum home page they will see table with all original posts and the table is not filled with any replies. The table has a hyperlink component for topic that returns a second page with a different query that DOES display FIRST the originating post and then all replies in ASC order by Date. Another note is that I have 2 Forums so I used forumid to identify posts from the two different forums. I have never built a forum before and I have no doubt that I will find problems with this setup, but so far it's all working well. Now if anybody can tell me how to replaceAll /n with <br> to display carriage returns in table...I would be grateful! -
Hi,
While creating a menu using SE41 transaction, there's an option of "FAST PATH" when we try to assign icons, info text, etc.
Whats the significance of "FAST PATH" option?
Thanks & Regards,
RajeshHi Rajesh,
Fastpath is a kind of shortcut key which enable us to access menu using keyboard rather than mouse..
Suppose that you are creating a menu(File) and create a menu item (New). When you double click on the Function code, they will ask for Fast Path, Just give any of the letter (in NEW , you can give N , E or W ). Whichever character you give, you will get an underline below the character in the menu when you execute it.
In our case of File-> New , you can use the Alt+F then type whichever key you have given for fastpath and then OK CODE will be filled with the Function Code you have given..
HOpe your query is solved.
Regards,
SP. -
[SOLVED] error 404 in package downloads
i tried to install firefox, opera, pm-utils,polkit-gnome gvfs.
while installation i am getting this errors as mentioned below and nothing got installed and everything is pending hence.
1.for firefox 2 packages were not downloaded and no install happened
2.opera not at all downloading
3.pm utils the same like opera
4.for polkit-gnome gvfs a few missing and thus again pending work.
I am trying from yesterday and also did today, i am getting the same results.
here is a snippet of one of the error .
sudo pacman -S firefox
resolving dependencies...
looking for inter-conflicts...
Targets (9): hunspell-1.3.2-1 libevent-2.0.19-1 libnotify-0.7.5-1
libvpx-1.1.0-1 mime-types-8-1 mozilla-common-1.4-3 nspr-4.9.1-1
nss-3.13.5-1 firefox-14.0.1-1
Total Download Size: 0.22 MiB
Total Installed Size: 49.99 MiB
Proceed with installation? [Y/n] y
:: Retrieving packages from extra...
error: failed retrieving file 'nspr-4.9.1-1-x86_64.pkg.tar.xz' from archlinux.polymorf.fr : The requested URL returned error: 404
error: failed retrieving file 'nspr-4.9.1-1-x86_64.pkg.tar.xz' from mirror.de.leaseweb.net : The requested URL returned error: 404
error: failed retrieving file 'nspr-4.9.1-1-x86_64.pkg.tar.xz' from mirror.nl.leaseweb.net : The requested URL returned error: 404
error: failed retrieving file 'nspr-4.9.1-1-x86_64.pkg.tar.xz' from mirror.rit.edu : The requested URL returned error: 404
warning: failed to retrieve some files from extra
error: failed to commit transaction (download library error)
Errors occurred, no packages were upgraded.
I am just putting one error message as it is same for the rest of all other packages. You see as above in firefox one package is pending, balance got downloaded yesterday. Similar happened in polkit-gnome gvfs . Whereas for opera and pm-utils upower nothing got downloaded at all.
In all the 4 cases i got the same error with no downloads or partial downloads .
Now these mirrors have been fast and best for me uptil now and no issue with them.
So basically what these error is and what i should do about the same to complete the installation.
Last edited by beopen (2012-08-12 10:20:37)WonderWoofy wrote:
Have you done pacman -Sy lately? It may be that your database is not in sync with the mirrors, so it is trying to retrieve package versions that aren't there.
Edit: I was too slow...
i have done the pacman -Syu just a week back and everything is uptodate.
@tomk
Short answer: pacman -Syu, not pacman -S.
Secondly do you install firefox or any other package with pacman -Syu firefox or pacman -S [packagename] ????
i have atleast so far installed everrything with pacman -S packagename
this is what the pacman wiki says
Installing specific packages
To install a single package or list of packages (including dependencies), issue the following command:
# pacman -S package_name1 package_name2 ...
lastly i solved the problem and the installation went right by unchecking a few more mirrors and the same went alright now.
So for the moment i am labelling the query as solved.
Thanks. -
Dear gurus
Im generating a report using structure RFPOSXEXT. problem im facing is that im getting all the document numbers which are open items and cleared items but im not getting the document number of a parked items. can you tell me how. ?
regards
Saad NIsarADDTIONAL :
Create your new report using the table RBKP : Invoice header...
here use the field RBSTAT and entry as PARKED...and then execute...
It will show all parked documents...
HOPE YOUR QUERY IS SOLVED NOW...
hi,
What you want exactly?? If you wanna see just Parked invoices, then can check it form FBV3 report...
FBV0 is used for post/delete the park invoices...
Hope it helps..
Regards
Priyanka.P
Edited by: Priyanka Paltanwale on Apr 9, 2009 10:22 AM -
Column optimization in GUI_DOWNLOAD--Exce
Hi Experts,
I am writing an Excel file using GUI_DOWNLOAD function module. Is there any way to do column optimization in Excel file while downloading.
Thanks and regards,
VenkatHi,
There is a Complete & Very good documentation by SAP available on this URL. Please read this.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/204d1bb8-489d-2910-d0b5-cdddb3227820
Hope your query get solved.
Thanks and regards,
Ramani N
Maybe you are looking for
-
Stock Transfer Order for Delivery Note
Hello i have facing some problem in client i have seen one STO with Plant to Plant but iam afraid that the supplying plant and receiving plant are same , (took it as BP01 supplying plant BP01 receiving plant) in that STO they have mentioned 3 materia
-
ME59N - Customize it to change POs? User Exit?
Hi all, We are using the automatic PO creation program (ME59N) to convert approved requisitions with a fixed source of supply to purchase orders. We have scenarios at our company where, after the PO is created and sent to the vendor, a change is to b
-
Getting PO number as file name when getting output as pdf file
Hi Experts, Is there any possibility to get PO number into file name (instead of spool number) when getting output as pdf file. Since I'm printing POs in batches (as pdf) it is too difficult to find exact PO among all the pdf files. If PO number main
-
URGENT HELP in Panel with CardLayout
I have a frame class in which I have added one panel and inside that 3 frames.I want to see the frames depending upon each request,the panle is has CardLayout.When i create an instance of the this class in my main and try to show one of the cards it
-
Error Java when installing DCNM 6.3
Hi my friend: Some have this problem when installing DCNM 6.3 on windows 2012 R2 standard java 8.0 Thank for all Marco.