Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

compre toata in where clue oracle

Posted on 2016-11-03
4
Medium Priority
?
74 Views
Last Modified: 2016-11-04
hi am geting this error in this query invalid identifie
select itemN0, item_in_qty - nvl(qty_out,0)qty from employee,dept  
where employee.deptid = dept.deptid  
and qty > dept_qty --how can i compare the  

Open in new window

0
Comment
Question by:chalie001
4 Comments
 
LVL 54

Assisted Solution

by:Ryan Chong
Ryan Chong earned 1000 total points
ID: 41873488
try:

select itemN0, item_in_qty - nvl(qty_out,0) qty from employee,dept  
where employee.deptid = dept.deptid  
and item_in_qty - nvl(qty_out,0) > dept_qty

Open in new window

0
 
LVL 35

Accepted Solution

by:
Pawan Kumar earned 1000 total points
ID: 41873491
Try..

select itemN0, item_in_qty - nvl(qty_out,0) qty from employee,dept  
where employee.deptid = dept.deptid  
and (  item_in_qty - nvl(qty_out,0) )  > dept_qty

Open in new window


Try 2..


SELECT * FROM
(
	select itemN0, item_in_qty - nvl(qty_out,0) qty from employee,dept  
	where employee.deptid = dept.deptid  
)
WHERE qty > dept_qty

Open in new window

0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 41873557
I just wanted to mentioned that it is giving an error because it could not refer to the column alias qty in the where clause which you have used in the select.

As mentioned, you need to use the expression itself in the where clause or use an inline view query.

Thanks,
0
 

Author Closing Comment

by:chalie001
ID: 41873560
correct solution
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question