Sql query
-
hi want to find the out puts There are 2 fields namely name,mark The following are the values in the field name....mark A...........10 A...........10 B...........20 C...........15 C............5 my output should be in the form :----- name...........mark A................20 B................20 C................10 Please write a query for this ???
-
hi want to find the out puts There are 2 fields namely name,mark The following are the values in the field name....mark A...........10 A...........10 B...........20 C...........15 C............5 my output should be in the form :----- name...........mark A................20 B................20 C................10 Please write a query for this ???
Parameswar Mal wrote:
Please write a query for this ???
Please specify the route between the input and output. It is not obvious. A seems to add the marks C substracts one from the other. What are the rules for this? Given that a SQL works on SET based operations with no intrinsic order how do you work out which number should be subtracted from the other. I don't know what B does as there is only one of them.
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
hi want to find the out puts There are 2 fields namely name,mark The following are the values in the field name....mark A...........10 A...........10 B...........20 C...........15 C............5 my output should be in the form :----- name...........mark A................20 B................20 C................10 Please write a query for this ???
Are you trying to find the average or sum? If C's mark is wrong, then
select A,sum(mark) from tblName group by name order by name
If A's mark is wrong, thenselect A,avg(mark) from tblName group by name order by name
Regards, Arun Kumar.A