473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help in writing a query

274 100+
hi everyone
I am using vb6 and access2003 combination. I have divided product codes in several catagories(11,12... ) and then using these catagories to make product codes (11001,11002,...) . For my daily closing report I want to see totals of all catagories belonging to one catagory group. I want to retrieve sum of particular group of catagories.
these catagories are
Metals (products having catagory codes 10-16)
Papers (................................................. ..18)
UBC (...............................................19-31)

I have two tables one for category codes, one for product codes, but no table for group codes.
I have tries doing this using parent child commands(poor approach because I could not use all child commands one report if I use it with dataenviornment)
any suggestions please.
regards
Nov 15 '07 #1
3 1041
QVeen72
1,445 Expert 1GB
hi everyone
I am using vb6 and access2003 combination. I have divided product codes in several catagories(11,12... ) and then using these catagories to make product codes (11001,11002,...) . For my daily closing report I want to see totals of all catagories belonging to one catagory group. I want to retrieve sum of particular group of catagories.
these catagories are
Metals (products having catagory codes 10-16)
Papers (................................................. ..18)
UBC (...............................................19-31)

I have two tables one for category codes, one for product codes, but no table for group codes.
I have tries doing this using parent child commands(poor approach because I could not use all child commands one report if I use it with dataenviornment)
any suggestions please.
regards
use this SQL:

Select C.CatCode,C.CatName, Sum(P.Qty), Count(P.*) From
CatMas C, Product P Where C.CatCode = P.CatCode Group By
C.CatCode,C.CatName

Regards
Veena
Nov 15 '07 #2
creative1
274 100+
I ahev follwoing table
catagory_codes(cat_code,description)
product_codes(cat_code, item_code,description,unit_price,...)
inv_total(tran_id,date.................i m not using date yet)
inv_detail(tran_id,item_code,quantity,price..)

here I have to use orice in table inv_detail not in product_codes because they may vary.

here is what i am using to get total of metals(by grouping cat code)

SELECT SUM(inv_detail.price * inv_detail.quantity) AS price1 FROM catagory_codes, product_codes, inv_detail WHERE catagory_codes.cat_code = product_codes.cat_code AND product_codes.Item_code = inv_detail.item_code GROUP BY catagory_codes.cat_code HAVING (catagory_codes.cat_code > 9 AND catagory_codes.cat_code < 19)

the problem is it only get me for one group.
It looks like I should create another table. It has screwed my mind. Please help me.
regards
farhana
Nov 15 '07 #3
creative1
274 100+
never mind I did it on my own.
thank for help Veena I got some clues though
farhana
Nov 15 '07 #4

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

Similar topics

0
by: Mike N. | last post by:
Hello to all: First let me apologize for the length of this question, I've made an attempt to include as much information as is needed to help with the question. I am having problems putting...
10
by: Peschtra | last post by:
Hello -- I am trying to write to a a MySql database using php, and I seem to be hitting a wall. I am attaching my php file in case someone can look at it. When I run it, I don't get any error...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
6
by: Takeadoe | last post by:
Dear NG, Can someone assist me with writing the little code that is needed to run an update table query each time the database is opened? From what I've been able to glean from this group, the...
2
by: mmitchell_houston | last post by:
I'm working on a .NET project and I need a single query to return a result set from three related tables in Access 2003, and I'm having trouble getting the results I want. The details: ...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
47
by: Jo | last post by:
Hi there, I'm Jo and it's the first time I've posted here. I'm in process of creating a database at work and have come a little unstuck.....I'm a bit of a novice and wondered if anyone could...
4
by: BeeMarie | last post by:
Hi, I've been trying to figure out this query for several days. I'm not that familiar with writing SQL statements, but in order to get the results I want, I think I need a subquery which requires...
6
by: Daveo | last post by:
Hi there, I have a query (say it's called "Query1") that contains data in the following structure: id reference scoretype score -- -------------- -------------- ...
2
by: DavidPr | last post by:
I have a Bible database and I need help writing the query a little bit of styling. I want to display all the books and chapters (which will be linked to another page -passage.php) that will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.