Solved

QuickReport Question (SQL Also)

Posted on 1997-09-26
5
170 Views
Last Modified: 2013-11-22
Hi,
I need to create a report and heres the problem and what needs to be done:

I have a database of items we shipped.
There is a main id which is by customer and under that there are item ids. for every item there is a cost. the main number is how the tables are linked. I have whriten an sql which successfully lists all the clients and items chipped for a day but now I need an option to make a filter for the Query that would select all the clients and all the item ids
where the total cost for ALL the item ids under the customer is <= 0.

Heres what it should look like in the end

Client/Item ID                 Date         Price
1234567
         01234567              ../../..     00.00
         12345678              ../../..     00.00

The filter MUST exclude all the client ids that have the sum of all the item ids totalling >0.2.

My current filter, for some reason, works but the problem is that it does exclude all the itemid's without the right price BUT it doesnt exclude the other ids associated with that client or the client id itself.

Please Help as This is VERY urgent.
If you need more info,
Please E-Mail me at:
maxcom@interserv.com
0
Comment
Question by:MAXcom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Expert Comment

by:d4jaj1
ID: 1346357
Whom ever answers this question, please take a look at a very simular question dated 9/, since I think the answer would apply to both questions.  MAXcom, I hope you don't mind me piggy-backing on your question, but I think the questions are the same and I need an answer really fast also.
0
 
LVL 22

Expert Comment

by:pivar
ID: 1346358
Hi MAXcom,

I think you have to tell us which tables you have and how they  look likes.

/pivar
0
 
LVL 1

Accepted Solution

by:
dionysos_swamp earned 170 total points
ID: 1346359
I would assume that you have two tables:
client(main_id,blablabla)
and
goods(main_id,date,price,blalbllblb)

to get all the clients that have received goods for <= 0 the sql would be something like:

select * from client c, goods g where
 c.main_id=g.main_id and
 ((select sum(price) from goods sg
   where sg.main_id=c.main_id) <= 0)

cool?

0
 

Author Comment

by:MAXcom
ID: 1346360
Thanks,
Even though the sql you gave me didnt work by converting it straight to the real tables, it did get me on the right track.
MAXcom
maxcom@interserv.com
0
 
LVL 1

Expert Comment

by:dionysos_swamp
ID: 1346361
Glad to have been of service.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question