Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

How to design new query to take off invoice? Expand / Collapse
Author
Message
Posted Tuesday, December 30, 2008 4:45 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 6, 2009 3:45 AM
Points: 12, Visits: 15
Invoice Date activity activity activity location
102 14-Mar-06 A SS80 SS70 L20.POD
102 24-Jul-06 A SS78 L20.POD
102 21-Aug-06 A AS0630 L15.PS
102 25-Aug-06 A SS71 L20.POD
102 01-Sep-06 A SS76 L20.POD
102 21-Nov-06 A SS74 L20.POD
105 25-Aug-06 A SS71 L20.POD
106 01-Sep-06 A SS76 L20.POD
107 21-Nov-06 A SS74 L20.POD

How to take off Invoice 102=AS0630 and keep invoice 105,106 and 107.

Lakh
Post #627219
Posted Tuesday, December 30, 2008 5:09 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 6:05 PM
Points: 35,832, Visits: 32,505
You have 2 activity columns... what are they really called?

And please... not nice to double post.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #627238
Posted Tuesday, December 30, 2008 5:37 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, May 23, 2014 5:59 AM
Points: 329, Visits: 470
Do you want one row per invoice?



Madhivanan

Failing to plan is Planning to fail
Post #627262
Posted Tuesday, December 30, 2008 5:50 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 6, 2009 3:45 AM
Points: 12, Visits: 15

If any invoices matching to code AS0630 that showing me the invoices are paid and take it off my list.
Post #627269
Posted Tuesday, December 30, 2008 6:07 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, May 23, 2014 5:59 AM
Points: 329, Visits: 470
Lakhbir.Bhatti (12/30/2008)

If any invoices matching to code AS0630 that showing me the invoices are paid and take it off my list.

select * from table as t
where not exists(select * from table where invoiceno=t.invoiceno and activity='AS0630')




Madhivanan

Failing to plan is Planning to fail
Post #627278
Posted Tuesday, December 30, 2008 6:42 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 6, 2009 3:45 AM
Points: 12, Visits: 15
Thanks

Lakh
Post #627307
Posted Tuesday, December 30, 2008 6:51 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, May 23, 2014 5:59 AM
Points: 329, Visits: 470
Lakhbir.Bhatti (12/30/2008)
Thanks

Lakh

You are welcome :)




Madhivanan

Failing to plan is Planning to fail
Post #627316
Posted Tuesday, December 30, 2008 7:21 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 6, 2009 3:45 AM
Points: 12, Visits: 15
Hi Madhivanan,

This is my query see below.

Please can you add the missing part for me. i am having erorro message.

SELECT *
FROM dbo_pod_surgery
WHERE phc_id="22/15729";

Lakh

Post #627348
Posted Tuesday, December 30, 2008 7:36 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, November 14, 2014 12:35 AM
Points: 115, Visits: 647
SELECT *
FROM dbo_pod_surgery
WHERE phc_id="22/15729";


If you know activity why r u using phc_id...
you can directly use the activity in where clause.
Post #627359
Posted Tuesday, December 30, 2008 7:46 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, January 6, 2009 3:45 AM
Points: 12, Visits: 15
From my report If this code "AS0630" tell me the person had they money back. I am only looking for people who have not receive they money back.

Lakh


Post #627367
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse