Click here to Skip to main content
15,905,144 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 3 table
ClientName: clientid(PK)
Collection: uniqueid(FK),id(PK)
WorckData: paymentid(FK),dueamt


Relatoin:
clientid(PK)=uniqueid(FK)
id(PK)=paymentid(FK)

ClientName have column:
paymentstatus='N'

Collection have column:
cproduct='Yes'

WorckData have column:
dueamt=5000

--i want data from collection + dueamt where cproduct='Yes' and paymentstatus='N'
Posted

Try this query...
SQL
SELECT CN.* , CL.*, WD.*
FROM
	CLIENTNAME AS CN
	INNER JOIN COLLECTION CL ON CN.CLIENTID = CL.UNIQUEID
	INNER JOIN WORCKDATA AS WD ON CL.ID = WD.PAYMENTID
WHERE CL.CPRODUCT='YES'
	AND CN.PAYMENTSTATUS = 'N'

If this solves your issue kindly up vote and mark this as solution.. Thanks..
 
Share this answer
 
v2
Comments
Karmesh_Madhavi 24-Feb-15 5:10am    
Thanx IT bro... it's work
manak chand 24-Feb-15 5:14am    
Your Welcome ... Pls upvote this solution.. :)
You can do that using JOINS.
You need to learn SQL JOIN first and then you can easily find the appropriate solution to your problem.
References:
SQL Joins[^]

You query should look like :
SQL
SELECT Clientid,cproduct,dueamt --,column1,column2 ..,columnn
FROM 
ClientName C
LEFT JOIN Collection L ON L.uniqueid=C.clientid
LEFT JOIN WorckData W ON W.paymentid=C.id
WHERE cproduct='Yes' AND paymentstatus='N'


Hope, that helps :)
 
Share this answer
 
v2
Comments
Karmesh_Madhavi 24-Feb-15 5:09am    
dueamt not in ClientName , by the way i was done, thank u.

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