Solved

compre toata in where clue oracle

Posted on 2016-11-03
4
41 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 49

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 17

Accepted Solution

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now