How use the value of one column to check the values of another row?How can I prevent SQL injection in PHP?How do you set a default value for a MySQL Datetime column?Can I concatenate multiple MySQL rows into one field?How can I SELECT rows with MAX(Column value), DISTINCT by another column in SQL?SQL select only rows with max value on a columnHow to import an SQL file using the command line in MySQL?SQL- Using a value in one tuple to get a value from another oneQuery to display from multiple tablesHow do I generate a MySQL view such that it show all objects in your heircachyHow can I show that someone is part of a shift that they supervise?
What ways have you found to get edits from non-LaTeX users?
Extreme flexible working hours: how to control people and activities?
I have a problem assistant manager, but I can't fire him
Can Rydberg constant be in joules?
Overlapping String-Blocks
Arriving at the same result with the opposite hypotheses
How do governments keep track of their issued currency?
English word for "product of tinkering"
Implement Own Vector Class in C++
Why didn't Voldemort recognize that Dumbledore was affected by his curse?
Why do some employees fill out a W-4 and some don't?
Which languages would be most useful in Europe at the end of the 19th century?
You have (3^2 + 2^3 + 2^2) Guesses Left. Figure out the Last one
Fixing obscure 8080 emulator bug?
Rebus with 20 song titles
How can I get an unreasonable manager to approve time off?
What speaks against investing in precious metals?
How is John Wick 3 a 15 certificate?
Why we don’t make use of the t-distribution for constructing a confidence interval for a proportion?
How to safely destroy (a large quantity of) valid checks?
Are there any important biographies of nobodies?
Cascading Switches. Will it affect performance?
A IP can traceroute to it, but can not ping
How come the nude protesters were not arrested?
How use the value of one column to check the values of another row?
How can I prevent SQL injection in PHP?How do you set a default value for a MySQL Datetime column?Can I concatenate multiple MySQL rows into one field?How can I SELECT rows with MAX(Column value), DISTINCT by another column in SQL?SQL select only rows with max value on a columnHow to import an SQL file using the command line in MySQL?SQL- Using a value in one tuple to get a value from another oneQuery to display from multiple tablesHow do I generate a MySQL view such that it show all objects in your heircachyHow can I show that someone is part of a shift that they supervise?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have to create a view that shows employee information for employees who are supervised by female supervisors. I have to display EMP_NUM, EMP_TITLE, EMP_FNAME, EMP_LNAME, and the manager’s employee number,
last name, and title.
The code that I tried only gives me the manager information for Lewis.
Below is a picture of the table EMP.
empTable
CREATE VIEW empSalary AS
SELECT EMP_NUM007, EMP_TITLE, EMP_FNAME, EMP_LNAME, EMP_MGR,
(SELECT EMP_LNAME FROM EMP WHERE EMP_NUM007 = EMP_MGR),
(SELECT EMP_TITLE FROM EMP WHERE EMP_NUM007 = EMP_MGR)
FROM EMP
GROUP BY EMP_NUM007;
mysql view
add a comment |
I have to create a view that shows employee information for employees who are supervised by female supervisors. I have to display EMP_NUM, EMP_TITLE, EMP_FNAME, EMP_LNAME, and the manager’s employee number,
last name, and title.
The code that I tried only gives me the manager information for Lewis.
Below is a picture of the table EMP.
empTable
CREATE VIEW empSalary AS
SELECT EMP_NUM007, EMP_TITLE, EMP_FNAME, EMP_LNAME, EMP_MGR,
(SELECT EMP_LNAME FROM EMP WHERE EMP_NUM007 = EMP_MGR),
(SELECT EMP_TITLE FROM EMP WHERE EMP_NUM007 = EMP_MGR)
FROM EMP
GROUP BY EMP_NUM007;
mysql view
add a comment |
I have to create a view that shows employee information for employees who are supervised by female supervisors. I have to display EMP_NUM, EMP_TITLE, EMP_FNAME, EMP_LNAME, and the manager’s employee number,
last name, and title.
The code that I tried only gives me the manager information for Lewis.
Below is a picture of the table EMP.
empTable
CREATE VIEW empSalary AS
SELECT EMP_NUM007, EMP_TITLE, EMP_FNAME, EMP_LNAME, EMP_MGR,
(SELECT EMP_LNAME FROM EMP WHERE EMP_NUM007 = EMP_MGR),
(SELECT EMP_TITLE FROM EMP WHERE EMP_NUM007 = EMP_MGR)
FROM EMP
GROUP BY EMP_NUM007;
mysql view
I have to create a view that shows employee information for employees who are supervised by female supervisors. I have to display EMP_NUM, EMP_TITLE, EMP_FNAME, EMP_LNAME, and the manager’s employee number,
last name, and title.
The code that I tried only gives me the manager information for Lewis.
Below is a picture of the table EMP.
empTable
CREATE VIEW empSalary AS
SELECT EMP_NUM007, EMP_TITLE, EMP_FNAME, EMP_LNAME, EMP_MGR,
(SELECT EMP_LNAME FROM EMP WHERE EMP_NUM007 = EMP_MGR),
(SELECT EMP_TITLE FROM EMP WHERE EMP_NUM007 = EMP_MGR)
FROM EMP
GROUP BY EMP_NUM007;
mysql view
mysql view
edited Mar 24 at 18:47
forpas
28k4930
28k4930
asked Mar 24 at 18:28
avaaaaalynavaaaaalyn
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You need a self join on the table:
select
e.emp_num, e.emp_title, e.emp_fname, e,emp_lname,
m.emp_num, m.emp_title, m.emp_fname, m.emp_lname
from emp e inner join emp m
on m.emp_num007 = e.emp_mgr
where m.emp_title = 'Mrs.'
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55327081%2fhow-use-the-value-of-one-column-to-check-the-values-of-another-row%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need a self join on the table:
select
e.emp_num, e.emp_title, e.emp_fname, e,emp_lname,
m.emp_num, m.emp_title, m.emp_fname, m.emp_lname
from emp e inner join emp m
on m.emp_num007 = e.emp_mgr
where m.emp_title = 'Mrs.'
add a comment |
You need a self join on the table:
select
e.emp_num, e.emp_title, e.emp_fname, e,emp_lname,
m.emp_num, m.emp_title, m.emp_fname, m.emp_lname
from emp e inner join emp m
on m.emp_num007 = e.emp_mgr
where m.emp_title = 'Mrs.'
add a comment |
You need a self join on the table:
select
e.emp_num, e.emp_title, e.emp_fname, e,emp_lname,
m.emp_num, m.emp_title, m.emp_fname, m.emp_lname
from emp e inner join emp m
on m.emp_num007 = e.emp_mgr
where m.emp_title = 'Mrs.'
You need a self join on the table:
select
e.emp_num, e.emp_title, e.emp_fname, e,emp_lname,
m.emp_num, m.emp_title, m.emp_fname, m.emp_lname
from emp e inner join emp m
on m.emp_num007 = e.emp_mgr
where m.emp_title = 'Mrs.'
answered Mar 24 at 18:53
forpasforpas
28k4930
28k4930
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55327081%2fhow-use-the-value-of-one-column-to-check-the-values-of-another-row%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown