Skip to content
Advertisement

single table parent child relationship query

I have written a query to get the items from the table which doesn’t have any child items. It’s working fine but is very slow. Any better/easier/optimized way to write the same thing?

Few of the fields are these to get the idea of a structure

Query should only return the 4rth item

Advertisement

Answer

Try below. Also consider creating indexes on PARENT_ITEM_ID and ITEM_ID

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement