Click here to Skip to main content
14,661,076 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

dear,
you have to write
select billno,item from table where preferences='Parcel'
   
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
Rate this:
Please Sign up or sign in to vote.

Solution 3

Try this

select billno,SUM(amt)as Billamt from temp 
where preferences='Parcel'
group by billno
   
Rate this:
Please Sign up or sign in to vote.

Solution 5

Hi
try this
SELECT distinct Temp.Billno
     ,Billamt
      ,[item]
  FROM Temp t inner join billing b on t.BillNo=b.BillNo where preferences='Parcel'


Best Luck
   

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