Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

having problems with <> working

Featured Replies

  • Newbies

I have a Computer table and a Service table.  They are related on field pk_ComputerId and fk_ComputerId respectively.  I am trying to find all the computers that do not have a service call.  I have been able to find the computers that do no problem as follows:

 

ExecuteSQL ( "SELECT pk_ComputerId FROM Computer WHERE pk_ComputerId = ANY(SELECT fk_ComputerId FROM Service)" ; "" ; "" )

-or-

ExecuteSQL ( "SELECT pk_ComputerId FROM Computer c JOIN Service s ON c.pk_ComputerId = s.fk_ComputerId)" ; "" ; "" )

 

I must be missing something in my logic because I would think you could replace the = with a <> in either of the statements above and get a list of computers that do not have service calls.  But the result I get is all of the records in the Computer table regardless if they have an entry in the Service table or not.

 

Can someone please help me adjust my logic on this!

You want all computerIDs from Computers that are not represented in the Services table.

 

The easiest way to express that statement in SQL is probably:

ExecuteSQL ( "
  SELECT pk_ComputerId 
  FROM Computer 
  WHERE pk_ComputerId NOT IN
    ( SELECT DISTINCT ( fk_ComputerId ) FROM Service )
  " ; "" ; "" 
)

This is new to me as well!  Thank you, Wim!  :laugh2:

  • Author
  • Newbies

Thank you eos!  That worked great.  I had tried NOT but was not familiar with NOT IN. 

 

 

WIM thanks for the heads up, but in this case I am dealing with keys so if I have a blank I have other problems.

DLB.. I would guess that the "ANY" part of this expression is NOT supported by ExecuteSQL  ...ExecuteSQL ( "SELECT pk_ComputerId FROM Computer WHERE pk_ComputerId = ANY(SELECT fk_ComputerId FROM Service)" ; "" ; "" )

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.