Question: I have two SQL Server queries, and I need to display final output result in a C# gridview:

```
Select *
From PayBack 
Where DATEDIFF(day, GetDate(), (Expirydate)) < 0 
  and DATEPART(yyyy, Expirydate) = '2018' 
  and DATEPART(Month,Expirydate) = '02' 

Select Nomclient, Numero1, Numero2, Numero3, Email1, Email2 
From Client 
Where Nomclient In (Select Client from PayBack)

```

How to merge this into one query?

Answer: 
Try this -

```
Select PB.*,C.Nomclient,C.Numero1,C.Numero2,C.Numero3,C.Email1,C.Email2 
From PayBack as PB
Inner Join Client as C on C.Nomclient = PB.Client
Where DATEDIFF(day,GetDate(),(PB.Expirydate))<0 and
DATEPART(yyyy,PB.Expirydate) = '2018' and DATEPART(Month,PB.Expirydate)='02' 

```
```
Select 
    Nomclient,Numero1,Numero2,Numero3,Email1,Email2 
from 
    Client 
where 
    Nomclient in (
        Select Client 
        From PayBack 
        where 
            DATEDIFF(day,GetDate(),(Expirydate))<0 and DATEPART(yyyy,Expirydate) = '2018' 
            and DATEPART(Month,Expirydate)='02'
    )

```