|
Error s: SELECT IDUser, MAX(Year)
FROM MyTable
GROUP BY Year
Exception : "Column IDUser is invalid in the select list because it is not contained in erther an aggregate function or the Group by clause"???
|
|
|
|
|
SELECT o.ID, s.IDUser, s.Year
FROM MyTable AS o
INNER JOIN (SELECT IDUser, MAX(Year)
FROM MyTable
GROUP BY IDUser) AS s
ON o.IDUser = s.IDUser AND o.Year = s.Year
It is OK. Thanks you very much !
|
|
|
|
|
Ah... Sorry - I mistyped the query. Glad you figured it out.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
select A.CategoryName, B.CustomerId , sum(A.CategoryId) as SumOfCID from Categories A , Customers B
the above query makes the following error
you tried to execute a query that doesn't include the specified expression 'CategoryName' as part of an aggregate function.
i am using vb6 and access
-----
thanks
|
|
|
|
|
use GROUP BY clause
select A.CategoryName, B.CustomerId , sum(A.CategoryId) as SumOfCID from Categories A , Customers B GROUP BY A.CategoryName, B.CustomerId
request you to pls check GROUP BY clause usage in SQL (language)
hope you are not aware
Note:
you are fetching data from two table and there is no join specified.
Regards
KP
|
|
|
|
|
how to use auto increment property in ASP.NET
|
|
|
|
|
Auto increment could be done in sql server 2000 by using identity.
You wanted in ASP.Net, could you explain in brief what exactly you are looking for?
Gautham
|
|
|
|
|
I need to connect the MySql database. Can anyone tell me what's the namespace to use for the connection and how do to connect .
Regards,
LEE
|
|
|
|
|
Create ODBC connection and create DSN for ur MySql DB.
rahul
|
|
|
|
|
Ok..! the namespace for the MySQL is Odbc: what object is used for connection
Regards,
LEE
|
|
|
|
|
Dear all,
i am using sql 2005 , asp.net and C#.
i have made reference to two table that is master and transaction.
sp that no data in transaction will be saved if its not exist in master. Now when i goes to delete the record which is there in transaction. i get refercial table error message. i would like to know how can i make sure that if data exist in transaction table. instead of sql error i pop up some error.
please guide me.
thank you
regards
imran khan
|
|
|
|
|
How can i view the size of a record in sql server express 2005? What is the query?
X
|
|
|
|
|
You can work out the average size of a record by running:
exec sp_spaceused 'MyTableName'
That gives you the number of rows, and the amount of space taken-up by the data and indexes.
|
|
|
|
|
Hai everybody,
I am new to triggers in SQL Server.
Can you please tell me can i combine the insert and update events in the SQL trigger as we do it in Oracle.
If yes, then how can i check it whether it is an inserting or updating event. (In oracle we will use INSERTING or UPDATING or DELETING.)
I am going to update a column with 1 (as it is a bit field) and then i have to perform some steps based on the value and later on again i want to reset the value to 0 in a trigger.
Can i perform this? If yes or no , how can i do it?
-- modified at 1:47 Monday 25th June, 2007
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
|
I have gone through the reference what you gave. but there is no hint for combining the insert and update events in a single trigger?
I want to combine them because i am going to perform the same operations partially.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
CREATE TRIGGER TRIGGER_NAME
ON TABLE-NAME
FOR INSERT, UPDATE
.....
.....
.....
you can achieve your functionality by writing your logic in this trigger!
Gautham
|
|
|
|
|
Hi ,
I installed the SQL Server 2005 with all the components.actually i want to bractice the SQL Server Business Intelligence Development Studio as i study.....the thing is SQLServer BI is different, meening that new -> project template is diffent..It is same as MS Visual Studio 2005.(I have already installed that also.)
i want BI as it is in initial...
something wrong that i doing?? Is it same? i want that as it is...any setting to build..
Thanks in advance!
|
|
|
|
|
While raising an error using the RAISERROR statement is there any specific state and level no to be given, will it affect any thing. If so what nos i can specify?
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
|
RAISERROR ( { msg_id | msg_str } { , severity , state }
Error numbers for user-defined error messages should be greater than 50,000
severity the user-defined severity level associated with this message
State an arbitrary integer from 1 through 127 that represents information about the invocation state of the error. A negative value for state defaults to 1.
If U Get Errors U Will Learn
If U Don't Get Errors U Have Learnt
|
|
|
|
|
Thank you all.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Glad to help Always.
Regards,
Satips.
|
|
|
|
|
Hi
i have 2 questions in SQL 2005
First:
How to upload a picture in the database as i want each user to put his pic
second:
How to make the search CaseSentive
so it can diffrentiate bet
bahaa & BaHaa
Thanks a lot
|
|
|
|
|
I am currently working Asp.net with c#, inserting data from webform into sqlserver 2000 datatable.
table id column contain identity increment.It will increment id for every new recored.
I inserting 10 recoreds id 1 to 10 into table then deleted last two records (9&10) then inserting a new record
these record id having 11 insted of 9 in id column.
Plz help me .......
Thanks in adv
|
|
|
|