Solved

compre toata in where clue oracle

Posted on 2016-11-03
4
65 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 52

Assisted Solution

by:Ryan Chong
Ryan Chong earned 250 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 28

Accepted Solution

by:
Pawan Kumar earned 250 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
The viewer will learn how to implement Singleton Design Pattern in Java.

734 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