|
Well, you can't include a column in the select statement without it being contained in either an aggregate function or containing it in the GROUP BY clause.
Nathan Lindley
|
|
|
|
|
Exactly. I must be missing something on your requirement. You want one record per agtMast, and you want the other columns also. You have to determine what you want from the other columns.
For example:
SELECT agtMast, MAX(CustName), MAX(DateIssued)....
FROM table_name;
|
|
|
|
|
Yea, I used MIN(), but what I essentially did was MIN(column1) As Column1, etc.. and inserted the records into a temp table, cleared the original table, and then loaded the records back into the original table. I don't know why I didn't do this in the first place, but i guess i was looking for a more concrete way to do it. Oh well, this works.
Thanks again for the responses!
Nathan Lindley
|
|
|
|
|
Hi all.
I had some problems with my previous SQLserver so I decided to uninstall it.
I uninstalled SQLserver from add/remove in control pannel. also there was a folder named microsoft sqlserver in C/program files , I deleted that folder too .
then,I restarted my PC . after that,I put the CD and wanted to install it again...but aftar I clicked on the first "next"button,it was an error and didnt install :
the error is this : "a previous program installation created pending file operations on the installation machine.You must restart the computer before running setup"
but I restarted many times but the error is still here and I cant install the SQlserver.
please help me and answer me ... what should I do ?
|
|
|
|
|
|
thank u very much.
I have installed the SQL server 2000 but I have problem...
I cant register a new sql server ... the connection failed error has appeare on my local . why ?
I dont have any sql or database in enterprise. please help me.
thanks alot
|
|
|
|
|
i am new to asp/sql and of course, i have some problems with it.
please let me explain:
i have a problem with a sql result and its output in asp
my sql result table looks like this
city date payment total
================================================
city1 1/1/2007 Visa 123.32
city1 1/1/2007 Mastercard 23.30
city1 1/1/2007 AMEX 40.30
city1 1/2/2007 Mastercard 12.30
city1 1/2/2007 AMEX 234.20
city2 1/1/2007 Visa 111.11
city2 1/1/2007 AMEX 222.22
city2 1/3/2007 Visa 233.33
city3 1/1/2007 Visa 123.23
city3 1/1/2007 Mastercard 45.34
....
and so forth
there are 3 fix payment options I want to show always: Visa, Mastercard
and AMEX.
I would like to output this result table shown before as followed in
asp:
First sorted by city, then date, and then always followed by 3 fixed
columns for the payment types
City1 Visa Mastercard Amex
-------------------------------------------------------------------
1/1/2007 123.32 23.30 40.30
1/2/2007 - 12.30 234.20
next city
City2 Visa Mastercard Amex
-------------------------------------------------------------------
1/1/2007 111.11 - 222.22
1/3/2007 233.33 - -
next city
City3 Visa Mastercard Amex
-------------------------------------------------------------------
1/1/2007 111.11 - 222.22
1/3/2007 233.33 - -
I tried it with looping while checking if date and city changed.
however, every time i try it, i can't show it properly like the way i
want it.
Please, can somebody help?
If you need more information, please let me know.
thank you so much.
|
|
|
|
|
select City, PaymentDate,
sum(case PaymentType when 'Visa' then PaymentTotal else 0 end) as Visa,
sum(case PaymentType when 'Mastercard' then PaymentTotal else 0 end) as Mastercard,
sum(case PaymentType when 'Amex' then PaymentTotal else 0 end) as Amex
from PaymentTable
group by City, PaymentDate
order by City, PaymentDate
|
|
|
|
|
Thank you so much Andy!
I really appreciate this, that made my day.
Thanks
|
|
|
|
|
Hi,
Need a simple create table script for SQL server 2007.
Here's the structure:
Column1: primary key, integer, auto increment
Column2: Name, char, length 100, not null
Column3: address, char length 200, not null
Please help
ASP - AJAX is SEXY. PERIOD.
|
|
|
|
|
|
Can anyone help me out please? I keep getting errors when importing msado15.dll even when removing the one error that microsoft identified as a bug. For win ce 4.23, is it even possible?
|
|
|
|
|
Hi
I have exported pubs authors table into flatfile. I am trying to import the same flat file data into dataset in C#. Could you any one help me please.
Data from flat file to Dataset(same format like authors table).
kesavan
kesavan
|
|
|
|
|
|
Guys, can any body suggest a place where i can get general information about sql server(2000-2005 other than google and MSC book.
Thanks
|
|
|
|
|
|
thanks hasan
|
|
|
|
|
Hello,
I have the following sql which will be stored a string, to be executed.
However, it gives me a syntax error -> Incorrect syntax near the keyword 'not'.
This is because sql server thinks its a keyword, how can I format my sql so that the arguments can be passed correctly.
<br />
BEGIN<br />
SET @SQL = 'CREATE PROCEDURE [dbo].[incident_selAllFilterRows]<br />
AS<br />
SELECT incidentID, company, subject, contact, phoneNo, assignedTo, priority<br />
FROM incident<br />
WHERE [status] = 'not started' AND [status] = 'in progress''<br />
EXEC sp_executeSQL @SQL END<br />
Many thanks,
Steve
|
|
|
|
|
steve_rm wrote: SET @SQL = 'CREATE PROCEDURE [dbo].[incident_selAllFilterRows]
AS
SELECT incidentID, company, subject, contact, phoneNo, assignedTo, priority
FROM incident
WHERE [status] = 'not started' AND [status] = 'in progress''
You have nested quotes (')... basically, the statement is terminated at the ' before the not and the rest of the statement is ignored / not recognised.
HTH
|
|
|
|
|
In addition to the previous respose. You might also want to check your WHERE clause for logical correctness.
WHERE [status] = 'not started' AND [status] = 'in progress'
What you are asking above is that the status column must be equal to "not started" AND "in progress" at the same time. Did you mean OR?
|
|
|
|
|
Missed that one...:->
Teaches me to read until the end
|
|
|
|
|
Thanks,
Single quotes should be used.
Steve
|
|
|
|
|
Hi,
I would like to know which is the most latest and good way of writing SQL Joins. Is it by using *=, =* etc.
eg:
select distinct * from employee,department
where employee.DepartmentID *=department.DepartmentID
( or)is it ANSI Standard?
Eg: SELECT distinct *
FROM employee
LEFT OUTER JOIN
department
ON employee.DepartmentID = department.DepartmentID
Please help.
rmr
|
|
|
|
|
shivarishxxxx wrote: select distinct * from employee,department
where employee.DepartmentID *=department.DepartmentID
This type of join is slowly being phased out. The Inner/Outer join is the way to go for you.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks for your prompt reply.
rmr
|
|
|
|