SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to design new query to take off invoice?


How to design new query to take off invoice?

Author
Message
Lakhbir.Bhatti
Lakhbir.Bhatti
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
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
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (340K reputation)SSC Guru (340K reputation)SSC Guru (340K reputation)SSC Guru (340K reputation)SSC Guru (340K reputation)SSC Guru (340K reputation)SSC Guru (340K reputation)SSC Guru (340K reputation)

Group: General Forum Members
Points: 340731 Visits: 42644
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.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Madhivanan-208264
Madhivanan-208264
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2799 Visits: 476
Do you want one row per invoice?



Madhivanan

Failing to plan is Planning to fail
Lakhbir.Bhatti
Lakhbir.Bhatti
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 15
If any invoices matching to code AS0630 that showing me the invoices are paid and take it off my list.
Madhivanan-208264
Madhivanan-208264
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2799 Visits: 476
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
Lakhbir.Bhatti
Lakhbir.Bhatti
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 15
Thanks

Lakh
Madhivanan-208264
Madhivanan-208264
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2799 Visits: 476
Lakhbir.Bhatti (12/30/2008)
Thanks

Lakh

You are welcome Smile



Madhivanan

Failing to plan is Planning to fail
Lakhbir.Bhatti
Lakhbir.Bhatti
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
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
brainy
brainy
SSC Eights!
SSC Eights! (949 reputation)SSC Eights! (949 reputation)SSC Eights! (949 reputation)SSC Eights! (949 reputation)SSC Eights! (949 reputation)SSC Eights! (949 reputation)SSC Eights! (949 reputation)SSC Eights! (949 reputation)

Group: General Forum Members
Points: 949 Visits: 649
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.
Lakhbir.Bhatti
Lakhbir.Bhatti
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search