473,464 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

What is SQL Query?

6 New Member
I am using VB6.0 and MS Access

I have 4 tabel

Table Name Field Name

1 – Product Item_Name

2 – Purchase Piece_No
3 – Invoice Itm_Qty These all have Field Name ( Item_Name )
4 – Refund Itm_Qty

Out Put I want is

Item_Name Pur (Piece_No) Invo(Item_Qty) Ref(Itm_Qty) Stock

ABC 123 300 200 50 50

KKK 02 100 20 10 70


How can I do this ?

Plz Help

Crystal Tech
Oct 21 '09 #1
2 1206
debasisdas
8,127 Recognized Expert Expert
What is the relation between these tables ?

You need to join the tables to get the desired result.
Oct 21 '09 #2
Crystaltech
6 New Member
I tried following query but its giving me wrong total
''''''''''''''''''''''''''''''''''''''
SELECT Prd.Item_Name, Sum(P.Piece_No) AS PStock, Sum(D.Itm_Qty) AS SoldStock, Sum(R.Itm_Qty) AS RefStock, Sum(P.Piece_No)-Sum(D.Itm_Qty)-Sum(R.Itm_Qty) AS Avl_Stock
FROM Refund_Detail AS R, (Product AS Prd INNER JOIN Purchase_Detail AS P ON Prd.Item_Name = P.Item) INNER JOIN Detail_Description AS D ON Prd.Item_Name = D.Item
WHERE (((Prd.Item_Name)=[P].[Item] And (Prd.Item_Name)=[d].[Item]))
GROUP BY Prd.Item_Name;
Oct 21 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: J Sharman | last post by:
What is the easiest way to import an XML Datafeed from a URL into a MYSQL Database? Possibly using PHP Regards Joe PS Please answer to group and joe@joesharman.co.uk
4
by: lawrence | last post by:
I'm very unhappy with the error message that I'm giving in this method: /** * 11-23-03 - getter * * We want to run the query against a MySql database and get back a
5
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I...
0
by: John Phelan | last post by:
I had a very large number of query statements that I had converted to SQL a long time ago aticipating that I would some day upsize my application. Every now and then when I do an import to a new...
3
by: White Bilky | last post by:
A97. Simplified description: I have a query which returns one field containing numbers. I have a table where one field contains the same numbers as the query (amongst others). The query and...
59
by: Chris Dunaway | last post by:
The C# 3.0 spec (http://msdn.microsoft.com/vcsharp/future/) contains a feature called "Implicitly typed local variables". The type of the variable is determined at compile time based on the...
1
by: Dot Net Daddy | last post by:
Hi, I am new to MS-SQL and I have a problem. Actually I have made similar queries on Oracle, but now I failed on MS Sql. First of all I am using SQL Server 2005, but I think it is not that much...
2
by: Aaron Reimann | last post by:
I have a lot of check boxes. This is an update of the check boxes, I want something was checked, then to do an insert (which is currently working), if something is no longer checked...delete the...
5
by: Bob Bridges | last post by:
Start with two tables, parent records in one and child records in the other, a one-to-many relationship. Create a select statement joining the two. Display the query in datasheet mode. When I...
4
bilibytes
by: bilibytes | last post by:
Hello i'm intrigued by what happens behind the scenes when I do a DB query to a database from php. I would like to know what is the exact life cycle of a mysql_query() I ask this question...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.