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 |
tmeans11
Starting Member
3 Posts |
Posted - 2009-01-27 : 21:53:18
|
Hello, Thanks so much for helping me with my other query! I have a question about a different query. Below is what I have so far.__________________________________________________________Query - select pp.patientid, ins.name, ins.contact, ins.address1, ins.address2, ins.city, ins.state, ins.zip, pp.last, pp.first, pi.insuredid, pv.ticketnumber, pi.last, pi.first, pvp.dateofservicefrom, pvp.feefrom patientprofile ppinner join patientinsurance pi on pp.patientprofileid = pi.patientprofileidinner join insurancecarriers ins on pi.insurancecarriersid = ins.insurancecarriersid inner join patientvisit pv on pp.patientprofileid = pv.patientprofileidinner join patientvisitagg pva on pv.patientvisitid = pva.patientvisitidinner join patientvisitprocs pvp on pv.patientvisitid = pvp.patientvisitidwhere pv.lastfileddate >= '2008-01-01' and pv.lastfileddate < '2008-02-28'AND pva.insbalance > $50.00group by pp.patientid, ins.name, ins.contact, ins.address1, ins.address2, ins.city, ins.state, ins.zip, pp.last, pp.first, pi.insuredid, pv.ticketnumber, pi.last, pi.first, pvp.dateofservicefrom, pvp.fee___________________________________________________________Results - Patientid Insurance Name Conact Add1347922 Health Plan of Michigan NULL- 777 Woodward AveAdd2 City St zip Ptlast Pt first PolicyNum Ticknum Suite600 Detroit MI 48226 Duck Donald 65555400 6957 Inslast InsFirst DateofService Total FeeNULL NULL 12/5/07 12:00 AM $415.00in my results I need the file to show one row per insurance company, ticketnumber - Then show all Dates of Service per ticketnumber on one row. So the end of the file would look like this...DateofService1 Fee1 DateofService2 Fee2 DateofService3 Fee3. If I wanted one row with several datesofservice how would I change my query above?Hopefully this can be understood. Can anyone help??? Thanks much... |
|
|
|
|
|
|