Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
abdulmukhtar
Starting Member
1 Post |
Posted - 2011-08-01 : 01:44:06
|
| Hi All,I have two tables. Table1 has two columns. First column is the date and second column is the customer ID.Table2 has two columns. First column is the CustomerId and Second column is the flag which tells whether loan has been offered to the customer or not.Requiremnt is that i want an output with 3 columns First column is the date from the first tableSecond column is the count of all the rows in the first tableThird Column is the result of inner join of two tables and the count of all the rows of the result where flag is 'Yes'.Please help meAcuvate |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-01 : 04:18:35
|
do you mean this?select t1.date,count(t1.customerid),count(case when t2.flag='yes' then t2.customerid else null end)from table1 t1left join table2 t2on t2.customerid = t1.customerid ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|