|
SELECT DISTINCT CustomerName, ID, Checked, FoundWith, URL
So you're saying that I will get every Record with a distinct URL with this statement? If so will the fact that it has checked(which may all be false at the beginning), or foundwith(which will more than likely have other urls to have the same FoundWith = # with them) so if i state all of those as having to be DISTINCT, does that mean it checks all before adding them? Because basically if there's a statement that says this:
SELECT DISTINCT URL, Checked FROM Emails WHERE Checked = False
Isnt that going to cause problems? because say they're all false, does that mean i'm to get only 1 urls back no matter what the difference in URLs?
And this statement,
DanielO wrote:
you could try the following
SELECT DISTINCT CUSTOMER_NAME ID CHECKED FOUNDWITH
FROM Emails WHERE checked = False ORDER BY foundwith
for all fields except url
I'm just trying to get one url that isnt checked, that's all. The only reason why i'm doing that is so that I dont have to open up another recordset and look for all Customers from that URL, then see if they've been checked or not, and if they've all been checked, then goto the next url.
This is all really just fickle, I just wanted to know if there was a way to get all the fields from a Record, where i had a DISTINCT Field that had to be different, then if i have that first distinct record, i could see if it had been checked, and if not then move onto the next one. *shrug*
Thanks guys.
~Timothy T. Rymer
http://tim.xpertz.com
http://www.digipen.edu
http://www.ttrx.com
|
|
|
|
|
Yes,* DISTINCT url is wrong.You can't use anything before DISTINCT expression.After DISTINCT you listed the column you want to be distincted and only they will be return.
So:
If you write:
SELECT DISTINCT * from Emails where checked=False
or
SELECT * from Emails where cheched=False
then only you will see same result .If you write:
SELECT DISTINCT url from Emails where checked=false
Then you will see only url column.
And this statement:
SELECT DISTINCT url,ID from Emails where CHECKED=false
Return url and ID column and their COMBINATION will be unique.
If you write:
SELECT * FROM Emails where Checked=false
you will get all columns that their Checked is false.You can't have DISTINCT expression here because if you have two rows with the same URL then which one should return?Maybe both of them have false record for CHECKED column.So as I understand the best statement for you is the last one.Why do you want DISTINCT here?
Hope that helps.If you need more help or information you are welcome.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
If I am reading this thread correctly than you should be able to use the GROUP BY clause. It does the same thing as DISTINCT but uses a different format.
It would look something like:
SELECT CUSTOMER_NAME, ID, CHECKED, FOUNDWITH, URL
FROM Emails WHERE CHECKED= False
GROUP BY CUSTOMER_NAME, ID, CHECKED, FOUNDWITH, URL
ORDER BY FOUNDWITH
|
|
|
|
|
Typing create table test.ooo ( a int check(a>0)); at the mysql prompt, i get an error message about using check constraint.
What's wrong?
rechi
|
|
|
|
|
I have a COM object method which has the following signature:
HRESULT MyMethod(LONG val1, BSTR val2);
When I call this method with the following syntax:
EXEC @hr = sp_OAMethod "MyMethod", NULL, 10, 'slkdfj'
I get a type mismatch error. Anyone have had this problem before?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Hello
I´m new to this board, and found already some good advice here, but for this problem i didn´t find an answer so far.
I already have an Excel-Doc that consists of several sheets. I need to write now in the 3rd sheet data, from the first row to row 40 in column 2 for example.
The problem is that the row doesn´t has a header, what would identify the column as a "table". But that´s no problem, because i can fetch a Recordset to a column for example.
But this allows me only to modify row 2 and all further rows, but not the first row where ODBC expects the table name.
But i also have to modify the first row, i MUST
Does anyone know to access by ODBC & SQL a EXCEL sheet/data from c++ on and writing at desired column and row position data?
Thank you
|
|
|
|
|
hi,
perhaps you could use automation execel
look at www.microsoft.com - knowledge base
HOWTO: Create Automation Project Using MFC and a Type Library (Q178749)
HOWTO: Use MFC to Automate Excel and Create/Format a New Workbook (Q179706)
hope it helps
Daniel O
|
|
|
|
|
Thank you , the second HOWTA article looks very interesting and elegant. Meanwhile i managed to do it by dropping a Column, for example with
[Sheet1$A:A] as tablename, and creating a new Table with same syntax passing a new "table" name.
niklas
|
|
|
|
|
Is there a way to SELECT from all tables of a specific "Type" in SQL Server 2000? For instance, I have abotu 50 tables that are of "User" type that I want to query, and I am not sure of the most efficient way. If it helps, this is the information I am wanting from ALL tables because they all contain these columns:
SELECT submitDate, requestorLastName, requestorFirstName, urlToForm, nof, status FROM <tablename> WHERE status = 'OPEN'
Can someone tell me the best way? Thanks...Robby
|
|
|
|
|
You can start with this:
sp_MSforeachtable 'select * from ?'
and then customize the select with whatever you want.
|
|
|
|
|
This is a great command. I can't seem to get it to do what I want. I have the command, but it seems to be just "picking" a table out of the database and displaying the properties. I am attempting to display this information in an HTML table. Here's the code:
sqlstr="sp_MSforeachtable 'select submitDate, requestorLastName, requestorFirstName, urlToForm, nof, status from ?'"
Set results = MyConn.Execute(sqlstr)
submitDate=results("submitDate")
requestorLastName=results("requestorLastName")
and so forth for each column...
I have approx 50 tables, and my html output only displays entries for only one of the tables...what do I need to do to be able to query all and display all for whatever table matches the query? Thanks
|
|
|
|
|
This is because you're getting multiple recordsets. When you reach the end of the first recordset, use the NextRecordset method of the recordset to get the next table.
Concussus surgo.
When struck I rise.
|
|
|
|
|
Does anyone know now to use mySQL's specialized SQL structures with MFC. I'm new to mySQL and I don't know any other way besides the SSQLS to write information to a mySQL db. I've tried using the sql_create_5 macro but it seems like it only allows you to use 5 fields and I need to use more than that.
Any help on this at all would be very much appreciated whether it be using the SSQLS or any other way to write to the db.
Thanks in advance.
- Monrobot
|
|
|
|
|
I have a net management application (coded in Win32 API) and need to have a database connectivity.
Idea is that an agent would run on each computer on the network and collect information about it and send it to a central database (probably MySQL).
What is the best way to send this info? I don't want to use COM, not very familiar with it and want to keep app as simple as possible.
Thanks
Regards,
Venet.
Donec eris felix, multos numerabis amicos.
|
|
|
|
|
hi,
There are many ways, but first what kind of database you use? (Oracle or MS Access database)
and what development envir. you are using? (VC++ 6.0 or VB6)
DanielO
|
|
|
|
|
Thanks for your interest.
I'm using VC++ 6.0.
There is a MySQL database running of a Linux server, and I need to connect to that database, to provide information about each PC, so the net admin could run a simple query and see the state of the network and of course each machine as well.
So what's the easiest way to connect to this database? Don't really want to use COM as this is quite time limited project.
Thanks
Regards,
Venet.
Donec eris felix, multos numerabis amicos.
|
|
|
|
|
hi,
i suppose you can do like this...
go windows, control panel, data sources obbc (via system/admin tools in W2K)
tab system dns add new choose sql server... etc.
in MFC 6.0 Add a new class, derived of CRecordSet, choose your new made sql server connection
and pick your table
hope it helps,
DanielO
|
|
|
|
|
What parameter should I set and where so that each time I run my program, a new database is created? I'm using the recordset.Open and didnt see anything there I could set...
Thanks,
ns
|
|
|
|
|
hi,
i have a access database with serveral tables, one of the table was named "Language"
While opening via ADO like:
pRecordset->Open ((IDispatch *) pCommand, vtMissing, adOpenForwardOnly,
adLockReadOnly, adCmdUnknown);
which generates a unknown error (" (1)") -> try catch
after almost two hours of debugging i couldn't figured out why it didn't work
but then i renamed the table in "LangTexts" and everything works fine!
i wonder what another names shouldn't be used...........
DanielO
|
|
|
|
|
Language could be a keyword, try it as a [Language], might help.
Martin
--------------------------------------------
C'mon we all know computers are experimental devices and should only be used for playing games.
Using them for alternative stuff like business, is clearly not using them for what they are intended.
Colin Davies
|
|
|
|
|
hi,
i just tested your idea, and you are right!!
thank you
DanielO
|
|
|
|
|
Can somebody tell me if its possible for a stored procedure to run a job.I have a case where in my user might want to generate the report from the form and then see the output as an excel file.I already have a job that runs the query and spits it out to an excel file.
But Now this same query must be done when the user wants. So i want to have a stored procedure that would execute the job whenever the user wants it from the website.
Please giveme some links to literature that can help me out.
Regards
Pradhip.S
Why Need Parking lots in Bars when Drunken Driving is Prohibited
|
|
|
|
|
If your user only want a query they can send a their select statement to mail server of SQL and then wiht sp_processmail stored procedure they will recieve their query,but I don't know about your case.I know very cool site about SQLServer.You can go there and put your question there.
www.Sqlteam.com
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
sp_start_job [@job_name =] 'job_name' | [@job_id =]
job_id
[,[@error_flag =] error_flag]
[,[@server_name =] 'server_name']
[,[@step_name =] 'step_name']
[,[@output_flag =] output_flag]
where
[@job_name =] 'job_name' is the name of the job to start.
[@job_id =] job_id is the identification number of the job to start.
[@error_flag =] error_flag is "reserved"
[@server_name =] 'server_name' is the target server on which to start the job.
[@step_name =] 'step_name' is the name of the step at which to begin execution of the job and applies only to local jobs.
The return code values are 0 (success) or 1 (failure).
This example starts a job named Nightly Backup:
USE msdb
EXEC sp_start_job @job_name = 'Nightly Backup'
|
|
|
|
|
I cannot find documentation/tutorials ANYWHERE for SQL Server 2000. All I want to do is increment my primary key automatically with a predefined "first two chars". For instance, when I take a New User request from my web site, I want my PK to be NU1, auto incrememnt NU2, NU3, etc...I'm sure it's a cinch...can anybody tell me how?
P.S. I have really benefited by using this site. Thanks for everyone's help on past questions. Hopefully, I'll be able to help answer questions one day!
|
|
|
|
|