![]() |
|
![]() | ||
|
Subject:
SQL Query needed
Category: Computers > Programming Asked by: nkans-ga List Price: $2.00 |
Posted:
27 Sep 2002 19:09 PDT
Expires: 01 Oct 2002 16:19 PDT Question ID: 69933 |
![]() | ||
|
There is no answer at this time. |
The following answer was rejected by the asker (they received a refund for the question). | |
Subject:
Re: SQL Query needed
Answered By: answerguru-ga on 27 Sep 2002 19:47 PDT |
Hi nkans-ga, The SQL query you are looking for is as follows: SELECT ta.Name, SUM(tb.qty) AS QtySum, COUNT(tc.taid) AS Counter FROM ta, tb, tc WHERE ta.id = tb.taid AND ta.id = tc.taid I've added in the ta.Name column because you probably need to know which entry in table A each set of count and sum figures correspond to. Cheers! answerguru-ga | |
| |
| |
| |
| |
|
Reason this answer was rejected by
nkans-ga:
The researcher is not able to give an answer. I request you to refund my paid amount. Kannaiyan |
![]() | ||
|
Subject:
Re: SQL Query needed
From: justask-ga on 27 Sep 2002 21:06 PDT |
Hello, nkans-ga! Did you try the following query (assuming every row in tb and tc has different id): SELECT ta.Name, SUM(tb.qty)/COUNT(DISTINCT tc.id) AS QtySum, COUNT(tc.taid)/COUNT(DISTINCT tb.id) AS Counter FROM ta, tb, tc WHERE ta.id = tb.taid AND ta.id = tc.taid GROUP BY ta.Name I like your question :) |
Subject:
Re: SQL Query needed
From: nkans-ga on 27 Sep 2002 22:12 PDT |
'tb' has 'taid' in its table where it will repeat. 'tc' has 'taid' in its table where it will repeat. I tried what justask given, no hope for the problem, yet remain unsolved. |
Subject:
Re: SQL Query needed
From: answerguru-ga on 27 Sep 2002 22:25 PDT |
It seems like there may be inconsistancies in your data which yields an incorrect result...I just tried the previous query and it works fine. Perhaps there is a subtle point about mySQL in particular that we are ignoring? |
Subject:
Re: SQL Query needed
From: nkans-ga on 28 Sep 2002 04:25 PDT |
I'm sorry answerguru. The answer provided by justask is alright only with certain condition where I don't have that one. The taid were same in my condition. With respect to the amount for this question, Did google asked you give a wrong answer if that founds cheap? I'm sorry I can pay only the affordable amount not the amount which you suggest to me. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |