Hi ,

I am working on a list :

Name Town Street House ID_Number
Marco Valletta Triq l-Ajkla 10, Fl 1 53290M
Mary Valletta Triq l-Ajkla 10, Fl 1 4748M
Victor Valletta Triq l-Ajkla 10, Fl 4 37867M
Krystle Valletta Triq l-Ajkla 14, Fl 1 52467M
Mariella Valletta Triq l-Ajkla 14, Fl 1 39093M
Therese Valletta Triq l-Ajkla 10, Fl 2 49346M
Emanuel Valletta Triq l-Ajkla 14, Fl 2 18536M
Patricia Valletta Triq l-Ajkla 14, Fl 2 15030M
Ramsey Valletta Triq l-Ajkla 14, Fl 2 49702M

I want to run a query which search with the ID cards 53290M, 52467M and 18536Mand provides me with those ID_Number information (name, town, street, house)** and** also other ID_Numbers which has the same Street and House.

Therefore it should result in :

Marco Valletta Triq l-Ajkla 10, Fl 1 53290M
Mary Valletta Triq l-Ajkla 10, Fl 1 4748M
Krystle Valletta Triq l-Ajkla 14, Fl 1 52467M
Mariella Valletta Triq l-Ajkla 14, Fl 1 39093M
Emanuel Valletta Triq l-Ajkla 14, Fl 2 18536M
Patricia Valletta Triq l-Ajkla 14, Fl 2 15030M
Ramsey Valletta Triq l-Ajkla 14, Fl 2 49702M

Thanks

Recommended Answers

All 2 Replies

SELECT * FROM YourTable t1
LEFT JOIN YourTable t2 ON t1.Street = t2.Street AND t1.House = t2.House
WHERE ID_Number IN ('53290M', '52467M', '18536M')

Thanks !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.