Click here to Skip to main content
14,425,525 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello friends,
I have table called
tbl_invoice_challan
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.
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

SELECT *
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.
   
Comments
dhage.prashant01 4-Mar-11 0:54am
   
WHERE = zd.liefschnum is this condition right. . ?
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
Ramalinga Koushik 4-Mar-11 1:24am
   
Its my pleasure
Ramalinga Koushik 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.
Rate this:
Please Sign up or sign in to vote.

Solution 2

This script returns all challanid with multiple invoiceid.
SELECT  challanid
FROM    tbl_invoice_challan
GROUP
BY      challanid
HAVING  COUNT(DISTINCT  invoiceid) > 1
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100