Maximo Open Forum

 SQL query

  • Everything Maximo
Ali Sartawi's profile image
Ali Sartawi posted 10-27-2024 04:42

in Location application to retrieve all locations without asset ID

Stevie Holloway's profile image
Stevie Holloway

SELECT *
FROM locations l
LEFT JOIN asset a ON l.location=a.location AND l.siteid=a.siteid
WHERE a.assetnum is null

Martin Fabra's profile image
Martin Fabra

Hi !

In the location app, in the where clause, write: 

location in (select distinct location from asset). 

Regards!

Darren Hornidge's profile image
Darren Hornidge

Hi Ali,

Hope all is good.

I read this as you want to know a where clause to use in the locations application that shows only locations that do not have any linked assets.

If so, please try this

NOT EXISTS (SELECT 1

            FROM asset a

            WHERE locations.location = a.location

            and locations.siteid = a.siteid

            )

I hope it works for you


Daz