Please Help this query should be simple :)

Here is what I have written so far: Basically I want it to return all the locations like I have specified that do not have DA-REPL in the area_code table but it is just returning everything it seems.
select l.location_no, l.zone_code, la.area_code
from move.location l, move.location_area la
where la.location_no = l.location_no
and l.zone_code = 'Z-BIN'
and (l.location_no like '%%-%%-2%%' or l.location_no like '%%-%%-1%%')
and la.area_code != 'DA-REPL'
order by 1
Here is what my results look like:
60-02-101     Z-BIN     WA-60
60-02-101     Z-BIN     WA-BIN
60-02-101     Z-BIN     WA-BINRESV
60-02-101     Z-BIN     WA-PALLET
60-02-102     Z-BIN     WA-60
60-02-102     Z-BIN     WA-BIN
60-02-102     Z-BIN     WA-BINRESV
60-02-102     Z-BIN     WA-PALLET
60-02-201     Z-BIN     WA-60
60-02-201     Z-BIN     WA-BIN
60-02-201     Z-BIN     WA-BINRESV
60-02-201     Z-BIN     WA-PALLET
Edited by: 906043 on Feb 20, 2012 2:23 PM

906043 wrote:
At it's most basic the query would look like this but this gives me 67,834 results I am dealing with a pretty big warehouse with many "la.area_code" entries I am only trying to get the locations in a specific zone('Z-BIN') that do not have 'DA-REPL' as an la.area_code as this would cause that location never to get replenishments when it becomes empty.
select l.location_no, l.zone_code, la.area_code
from move.location l, move.location_area la
where la.location_no = l.location_no
l.zone_code = 'Z=BIN'
and la.area_code != 'DA-REPL'
order by 1
Not sure if that helps anymore I am at a loss but still plugging away :)A little attention to code formatting could bring some sanity to yourself. Enclosing that formatted code in the code tags on this forum would bring a lot of sanity to those trying to help you:
select l.location_no
,      l.zone_code
,      la.area_code
from move.location l
,    move.location_area la
where la.location_no = l.location_no
      l.zone_code = 'Z=BIN'
and   la.area_code != 'DA-REPL'
order by 1And once it is formatted for easier reading by humans, it's easier to see that you are missing an "and" (maybe "or"?) in your WHERE clause.

Similar Messages

  • Urgent please help, this program should work

    Urgent please help.
    I need to solve or I will be in big trouble.
    This program works at my home computer which is not networked.
    The hard disk was put onto another computer at another location whihc is networked. Here my program worked on Monday 14 october but since for the last two days it is not working without me changing any code. Why do I receive this error message???
    Error: 500
    Location: /myJSPs/jsp/portal-project2/processviewfiles_dir.jsp
    Internal Servlet Error:
    javax.servlet.ServletException
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:460)
    at jsp.portal_0002dproject2.processviewfiles_dir_1._jspService(processviewfiles_dir_1.java:162)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
    at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
    at org.apache.tomcat.core.Handler.service(Handler.java:235)
    at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
    at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
    at java.lang.Thread.run(Thread.java:536)
    Root cause:
    java.lang.NullPointerException
    at jsp.portal_0002dproject2.processviewfiles_dir_1._jspService(processviewfiles_dir_1.java:132)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
    at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
    at org.apache.tomcat.core.Handler.service(Handler.java:235)
    at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
    at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
    at java.lang.Thread.run(Thread.java:536)

    foolishmatt,
    The code is quit large.
    to understand the program I think all the code needs to be examined.
    I would need to send to you in an email.
    Here is my e-mail
    [email protected]
    if you contact me than I can send the code to you.
    Thank you in advance.

  • Please help this: JNLP association extensions confict with arguments

    Hello, Please help this:
    I use <argument> tag to transfer some parameters to JWS application.
    I also use <associatio> tag to associate a specila file(such as .zzz) to JNLP. But when I doulbe click .zzz file, my application only get "-open" and file path as argument, those parameters in <argument> tag in my jnlp are lost!
    What should I do

    ..Is this a bug for JWS? No.
    ..association extensions tag conflicts with <argument>?Quoting the 'JNLP Specification', section 3
    'JNLP file', part 5 'Descriptor Information', under
    association element/mime-type attribute
    "An application making such a request
    should be prepared to have its main
    method invoked with the arguments
    -open filename and -print filename
    instead of any arguments listed with
    the application-desc element."

  • TS3682 I started updating my iPhone 4, but it went black screan and then started turning on and off non stop. I tried to hold the two buttons, but nothing different happened. Please, help! What should I do?!

    I started updating my iPhone 4, but it went black screan and then started turning on and off non stop. I tried to hold the two buttons, but nothing different happened. Please, help! What should I do?!

    First see if placing the iPod in Recovery Mode will allow a restore.
    Next try DFU mode and restore.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    If not successful then time for an appointment at the Genius Bar of an Apple store. You are not alone with this problem.

  • HT1339 my ipod nano 7th generation....works fine as long as it's on the docking station. when off the station, the display goes dark after a few seconds. it's fully charged. please help. this is the heartbeat of my business. thanks

    my ipod nano 7th generation....works fine as long as it's on the docking station. when off the station, the display goes dark after a few seconds. it's fully charged. please help. this is the heartbeat of my business. thanks

    In the worst case, it's still under warranty (all 7th gen nanos are still under one year from purchase).
    So, you disconnect it from power, and it almost immediately goes dead?  You can try a Restore... but it doesn't sound like the type of problem a Restore will fix.
    You should probably have it looked by Apple Tech Support.  If there's an Apple Store nearby, you can take it to the store's Genius Bar.  To avoid waiting, you can make a reservation at the store's web page
    http://www.apple.com/retail/

  • I can't forcequit firefox and shutdown my computer, nor can I open up any other programs or applications. Does anyone know how to fix this? please help this poor soul.

    I can't forcequit firefox and shutdown my computer, nor can I open up any other programs or applications. Does anyone know how to fix this? please help this poor soul.

    You can force quit applications
    >Force quit
    if that does not work you can force quit a computer shut down by hold the power button for an extended period.

  • HT201263 I have Iphone 4s on iso 6.1.3 I have tried to Update it to Iso 7.0.4 but the phone stuck on Recovery mode and now i cant update it or restore it to the old iso so please help what i should  do?

    I have Iphone 4s on iso 6.1.3 I have tried to Update it to Iso 7.0.4 but the phone stuck on Recovery mode and now i cant update it or restore it to the old iso so please help what i should  do?

    READ the article from which the question was posted and follow all the troubleshooting steps.

  • I have windows 7 and every time I try to play or add a song. It says itunes has stopped working. Please help this is frustrating.

    I have windows 7 and every time I try to play or add a song. It says itunes has stopped working. Please help this is frustrating.

    a further message  box states that Data Execution Prevention has closed the program.
    Try updating your QuickTime to the most recent version. Does that clear up the DEP errors in iTunes?

  • Ockeim getting problem in imovie & iphoto update.my 1st id is bld,i changed my id but during update it is showing my previous id.please help me how should i update my app by new id.

    im getting problem in imovie & iphoto update.my 1st id is blocked,i changed my id but during update it is showing my previous id.please help me how should i update my app with my new id.

    Contact App Store support. There's a link on the right hand side of the App Store Window. They're the only ones who can sort out account issues.

  • Ipad didnt work, i cant go back to the apps, and even i cant reboot the ipad. please help me, what should i do with my ipad? thank you.

    i read a book from ipad, when i want to change to a game, suddenly the ipad stuck. i cant go back home or even reboot from the turn on/off button, and now the ipad stuck. please help me, what should i do? thank you.

    If "Demo's" instructions helped...
    when i want to change to a game,
    Tap and hold down the app then tap the x with a circle then tap Delete.
    User your iPad for a few days to see if it's stable. If it is, then it's that one app causing the problem.
    Contact the app's developer (at their website) for support.

  • My iphone 5 gets hot while using it and while charging too.... Please help me what should i do?? Should i replace the battery....??  Because it gets hot even within 5 minutes also....  And it is happening from 2 weeks daily.

    My iphone 5 gets hot while using it and while charging too.... Please help me what should i do?? Should i replace the battery....??  Because it gets hot even within 5 minutes also....  And it is happening from 2 weeks daily.

    The Basic Troubleshooting Steps are:
    Restart... Reset... Restore from Backup...  Restore as New...
    Restart / Reset   >  http://support.apple.com/kb/ht1430
    Backing up, Updating and Restoring  >  http://support.apple.com/kb/HT1414
    If you try all these steps and you still have issues... Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step...
    Be sure to make an appointment first...

  • My Iphone 4s Will not delete the songs I want it to. I've tried Turning off "Show All Music" and then swiping left on the song to delete it, but it wont give me the option to delete the songs. Please help. (this is iOS.7 btw)

    I've tried Turning off "Show All Music" and then swiping left on the song to delete it, but it wont give me the option to delete the songs. Please help. (this is iOS.7 btw) It only does this for some of the songs, but the rest of them I can delete. This is really annoying, please help me ASAP. Thank yall for your time

    I've tried Turning off "Show All Music" and then swiping left on the song to delete it, but it wont give me the option to delete the songs. Please help. (this is iOS.7 btw) It only does this for some of the songs, but the rest of them I can delete. This is really annoying, please help me ASAP. Thank yall for your time

  • Someone please help this is getting irritating!

    how do I fix the system overload erra audio engin was not able to process all required data? someone please help this is getting irritating!

    You have a few options:
    1- Increase the Buffer Size in the Logic Devices Preferences to the maximum (1024)
    2- Freeze some Tracks with CPU intensive plugins
    3- Buy a faster computer
    Hope that helps
    Edgar Rothermich 
    http://DingDingMusic.com/Manuals/
    'I may receive some form of compensation, financial or otherwise, from my recommendation or link.'

  • Help this query

    hi all,
    This is my requirement
    APP_FIRST_PMT_DT + APP_TERM Should equal to APP_MATURITY_DT
    In my table
    APP_FIRST_PMT_DT---date datatype(Enter the first payment date.)
    APP_TERM ----number datatype(Enter the term/number of payments.)
    APP_MATURITY_DT---Date Datatype
    please write the query for the above requirement

    Two hours ago, you post the same question. Some guys spent time to try to help you there, and now what happens ? You re-post the same question and ignore the answers you got in your first thread. You could at least be more clear here than in your first thread, even not that minimum.
    You should ask for the good question as well, try to explain exactly what you have to do, what you already tried.
    Finally, more explicit you are, more you can get help faster, and less time we all (including yourself) will spent on that case which may be simple.
    Nicolas.

  • Please show this query, data not showing why?

    I created a report and write following query,it was working well since last 4 months but today automaticly not showing data I can undertstand why?
    Becuase I didnt make any changes in this query.
    Please help me
    Urgent
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    and merch_order.orderno not in
    (select export_order1.orderno from export_order1)
    ORDER BY MERCH_ORDER.ORDERNO
    there is no any error and msg header and footer print.

    Maybe , the query in "NOT IN" clause select export_order1.orderno from export_order1
    return the same rows as the following portion return....
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    OR
    there are no rows which conform to the joining condition between the two tables BUYER and MERCH_ORDER ....
    Regards,
    Simon

Maybe you are looking for