Solved

QuickReport Question (SQL Also)

Posted on 1997-09-26
5
165 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
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Strange behavior when a form is closed 6 58
control image tags in a string ? 12 134
Delphi: making a BW image transparent 10 41
Breakpoint doesn't stop in my variable 3 28
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

832 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