Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using two tables following
Temp
Billno  Item        Qty Rate amt Preferences
2       Icecream    2    10   20  Parcel
2       coffee      3     10   30  Parcel
1       Cream Salad  2     20   40  A/C
3        Cococola    5      15  60  Non A/C

Billing
Billno   Billamt
2           90
1           40
3           60

I want get the records which is parcel
BillNo    Billamt
2           90
Posted

dear,
you have to write
SQL
select billno,item from table where preferences='Parcel'
 
Share this answer
 
v2
Comments
devausha 10-Apr-12 6:33am    
it is displayed like following
Billno Billamt
2 90
2 90


And i want sum of total amount for the Parcel

If there are one more Billno for Parcel
It give sum of amount how to do it
Try this

SQL
select billno,SUM(amt)as Billamt from temp 
where preferences='Parcel'
group by billno
 
Share this answer
 
Hi
try this
SQL
SELECT distinct Temp.Billno
     ,Billamt
      ,[item]
  FROM Temp t inner join billing b on t.BillNo=b.BillNo where preferences='Parcel'


Best Luck
 
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