Welcome Guest, Not a member yet? Register   Sign In
Query info
#1

Hi i have a db this is two table :

location:
-id
-name
-id_materiale NULL
-quantity NULL

materiale:
-  id
- code
- description

I put material in location , how can iknow with a query wich material is not present in every location with a query or a model ?
Reply
#2

Hi Pippuccio76
SELECT * FROM material WHERE id NOTIN (SELECT id_materiale FROM location)
in this query, it will select first all id_material that is in a location and it will select all material that not match the provide id.
Hope it help.
Forgive me i am a French Speaker (try ngatcharius on Social Network)
Reply
#3

(This post was last modified: 09-02-2022, 02:52 AM by pippuccio76.)

(08-31-2022, 10:42 AM)ngatcharius Wrote: Hi Pippuccio76
SELECT * FROM material WHERE id NOTIN (SELECT id_materiale FROM location)
in this query, it will select first all id_material that is in a location and it will select all material that not match the provide id.
Hope it help.

it return 0 rows , this query  SELECT id_materiale FROM location return 7 record with id_material and other record with NULL ( I have recently started inserting)

EDIT:

It work in this way

SELECT * FROM material WHERE id NOTIN (SELECT id_materiale FROM location WHERE id_materiale IS NOT NULL)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB