Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I give the following query for selecting records from two tables for the report but it is display all the records please help me for solve this problem

Select T1.Billno,T1.Billdate,T1.BillAmount,T1.TPTCharge,T1.LBCharge,T1.Nettotal,T1.Tax,T1.Discount,T1.CName,T1.ONo,T1.Vno,T2.Item,T2.qty,T2.Rate,T2.Rate_Typ,T2.Amount,T2.Tax from Sales T1,Tempsales T2 where T1.Billno=T2.Billno  and  T1.Billdate>=@Billdate1 and T1.Billdate<=@Billdate2 order by T1.Billno"
Posted
Comments
[no name] 14-Apr-12 9:08am    
No one will ever be able to solve your problem for that simple fact that you did not state what exactly your problem is. You state that the query is working and displays the records so what is the problem?
Ganesan Senthilvel 14-Apr-12 9:10am    
Not clear. Are you not getting the expected result set? What is the exact problem?
devausha 14-Apr-12 9:11am    
I use the query for display reports. In the report I am using Billno group field. I am used two tables T1,T2 i want get records from this two tables group by billno. But i give the above coding it selecting all the records for every Billno from second table

1 solution

I think you really mean
SQL
SELECT T1.Billno,T1.Billdate,T1.BillAmount,T1.TPTCharge,T1.LBCharge,T1.Nettotal,T1.Tax,T1.Discount,T1.CName,T1.ONo,T1.Vno,T2.Item,T2.qty,T2.Rate,T2.Rate_Typ,T2.Amount,T2.Tax 
FROM Sales T1,Tempsales T2 
WHERE T1.Billno=T2.Billno  AND (T1.Billdate BETWEEN @Billdate1 AND @Billdate2)
ORDER BY T1.Billno
 
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