UserMaster
| ID | UserName | CreatedBy | Flag |
| 1 | Ashok | Admin | 1 |
| 2 | Amit | Admin | 1 |
| 3 | Amita | Admin | 1 |
| 4 | Amrita | Admin | 1 |
| 5 | Sandhya | Admin | 1 |
UserTransactions
| ID | UserName | SerialNumber | CertifiedStatus | Certifiedon |
| 1 | Ashok | A1 | 1 | 1-JAN-2016 |
| 2 | Ashok | A2 | 1 | 1-FEB-2016 |
| 3 | Ashok | A3 | 0 | 3-MAR-2016 |
| 4 | Amit | A4 | 0 | 1-APR-2016 |
| 5 | Sandhya | A5 | 1 | 3-MAR-2016 |
| 6 | Sandhya | A6 | 1 | 1-JAN-2016 |
| 7 | Sandhya | A7 | 0 | 1-JAN-2016 |
| 8 | Sandhya | A8 | 0 | 1-JAN-2016 |
| 9 | Amit | A9 | 0 | 3-MAR-2016 |
| 10 | Amit | A10 | 1 | 3-MAR-2016 |
Output –
There are total 5 users, out of which 3 users have entered details.
| UserName | Total Transactions | Certified Status | Date |
| Ashok | 3 | True | 3-MAR-2016 (Max date of transaction) |
| Amit | 3 | True | 3-MAR-2016 (Max date of transaction) |
| Amita | 0 | False | Null |
| Amrita | 0 | False | Null |
| Sandhya | 4 | true | 3-MAR-2016 (Max date of transaction) |
UserName –
Total Transactions – total transactions made by user
Certified stauts – if number of transactions is more than 0, then true, if zero then false
Date – Max Date of transaction
Also, how to get min and max date in output variable from stored procedure in asp.net c#??
My stored procedure –
@MinDateOut varchar(max) output
Select @MinDateOut = min(t.CreatedOn) from UserTransactions t

Manas MohapatraRank #182 · 13.2K reputationPosted Oct 26, 2016, 8:56 AM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted Oct 27, 2016, 12:42 AM EDT
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Oct 26, 2016, 10:34 AM EDT
Riddhi ValechaRank #794 · 2.9K reputationPosted Oct 26, 2016, 12:32 PM EDT
set @MaxDateout = (select convert(varchar(max), max(t.CertifiedOn),106) from UserTransactions t )
Message = "Error converting data type varchar(max) to int."
Nitin SontakkeRank #264 · 9.6K reputationPosted Oct 26, 2016, 7:29 PM EDT
Ananth GRank #1,176 · 1.5K reputationPosted Oct 26, 2016, 8:51 PM EDT