'SQL query to find duplicate orders with same invoice at the same address

I am trying to see how i can write a query to pull all the distinct permit numbers that have the same invoice numbers at the same address. For Example i have below tables

ADDRS Table ADD ID MAIL ID ORDER ID

SRVC ADDRES TABLE MAIL ID ST NBR ST NAME City STATE

ORDER TABLE ORDER ID ORDER NBR APPLY DATE

ORDER FEES TABLE Order ID FEEID ORDR NBR

INVOICE TABLE FEEID INV ID INV NBR AMT

The SRVC ADDRESS TABLE has the address information. If there ST NBR and ST NAME columns has the same value then check the ADD TABLE to look for all distinct ORDER ID and then use the order table to select only APPLY DATE > '1/2/22' orders that has the same INV NBR from the INVOICE TABLE



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source