Solved

QuickReport Question (SQL Also)

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

912 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now