General discussion

Locked

Run two differant queries in one table for two differant table

By pratikgosvami90 ·
I want to run some queries which can help me to get result:

I am new for sql

I have two different tables Item and ItemDynamic

In the Item table I have the columns ItemLookUpcode, ItemID and Total Quantity.

In the Item Dynamic table I have the columns ItemID (same as Item table) and Quantity, StoreID.

I want to result as in one table which can give me ItmLookupCode and Quantity (Item.Quantity - ItemDynamic.Qunatity)

I have tried some queries but not worked out please help me.

Thank you in advance.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Here

by Tony Hopkinson In reply to Run two differant queries ...

select Item.ItemLookUpCode, Item.TotalQuantity - ItemDynamic.Quantity as Quantity
From Item Left Outer Join ItemDynamic on Item.ItemID = ItemDynamic.ItemID

Assuming you want all ItemIDs in Item whether they have a corresponding entry
in itemdynamic
If you only want those with an itemid in ItemDynamic then change Outer to Inner.

This is a good site to learn stuff at.

http://www.w3schools.com/sql/default.asp

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums