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 |
|
hnomani
Starting Member
35 Posts |
Posted - 2001-05-22 : 14:02:12
|
| I am working on a reporting project using SQL Server 2000 database and a reporting tool (Crystal or Access). I have a report that is in tabular format, but each column represents a different condition. I am wondering, what would be the best approach to build this kind of Report?Example Code: ( My report has more than 15 complex conditions)The Report Columns:State:Company Number:1 Line2 Linesand so on..To get State & CompanySELECT DISTINCT state_cd, company_nbrFROM vw_offer_act_resTo get 1 LineSELECT COUNT(*)FROM (SELECT state_cd, company_nbr, svc FROM vw_offer_act_res WHERE line_ind = ‘R’ GROUP BY state_cd, company_nbr, svc HAVING COUNT(svc) = 1) aGROUP BY a.state_cd, a.company_nbrTo get 2 LineSELECT COUNT(*)FROM (SELECT state_cd, company_nbr, svc FROM vw_offer_act_res WHERE line_ind = ‘R’ GROUP BY state_cd, company_nbr, svc HAVING COUNT(svc) = 2) aGROUP BY a.state_cd, a.company_nbr |
|
|
|
|
|