Click here to Skip to main content
15,849,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,
I have table called
with follwing columns
1. invoice_challanid
2. invoiceid
3. challanid

I'm trying to find single challan in multipal invoice.
Can anyone help for the query.

FROM Test AS zd
WHERE (SELECT count(*) FROM Test AS t1
     WHERE = zd.liefschnum AND t1.pos = zd.pos) > 1

This is my sample query. Based on this you develop it for yours.
Share this answer
dhage.prashant01 4-Mar-11 0:54am    
WHERE = zd.liefschnum is this condition right. . ?
[no name] 4-Mar-11 1:25am    
I have given the sample query which i wrote for my application. see the answer for more details.This is my sample query. Based on this you develop it for yours.
dhage.prashant01 4-Mar-11 1:18am    
Well thanks for your support. .
i got through this query

select * from tbl_invoice_challan as IC1 where
(select COUNT(invoiceid) from tbl_invoice_challan IC2 where
IC1.challanid=IC2.challanid) > 1
order by challanid desc
[no name] 4-Mar-11 1:24am    
Its my pleasure
This script returns all challanid with multiple invoiceid.
SELECT  challanid
FROM    tbl_invoice_challan
BY      challanid
HAVING  COUNT(DISTINCT  invoiceid) > 1
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900