Hi :)
I have a query:
SELECT COUNT(*) as votes, a.member_id
FROM ballots a
WHERE ballot_id = 1
GROUP BY a.member_id
which yields something like:
votes member_id
1 paul
5 mike
3 noynoy
10 andy
2 noel
I'd like to be able to get the row "andy" because he got the highest "votes".
How do I change my query to ...
I need to get datetime from SQL table but I have two problems:
I need to refer to string from selected cell of DataGrid. I've tried "bksDataGrid.CurrentCell.Item" but that doesn't work.
Not really problem, but the cmd will return SQL datetime as object. Is it possible to convert it to .NET DateTime?
object obj = new object();
...
My question is when to use a specification pattern, and when to use specific SQL query.
I understood that specific pattern need to collect whole collection and post filter using concrete specification. But i dont't understand the advantage in front of specific SQL query.
CarColorSpecification cc = new CarColorSpecification(RED);
CarAge...
In our organization we have the need to let employees filter data in our web application by supplying WHERE clauses. It's worked great for a long time, but we occasionally run into users providing queries that require full table scans on large tables or inefficient joins, etc.
Some clown might write something like:
select * from big_t...
Is there a way to delete all WordPress authors which have 0 posts?
...
Hello, Im using SQL Server Management Studio 2008 (ssms.exe) connected with a local SQL Server 2000, so I notice that every time I try enter on Linked Server option It crash inmediatly so I want to delete all the servers linkeds there for try again.
What script should I use or what command on T-SQL I have to run for delete all and witho...
When I try to add a data-base in SQL Server 2008 (Right clicking on Databases folder->New Database) the only compatibility options given to me in the options tab are 70, 80, and 90.
However, I require the use of the DATE object, which doesn't work unless I set the compatibility level to 100.
I've tried using
exec sp_dbcmptlevel mydb,...
I have the following T-SQL query (a simple test case) running fine in MS SQL but cannot get the equivalent query in MS Access (JET-SQL). The problem is the additional criteria in the LEFT JOIN. How can I do this in MS Access?
T-SQL:
SELECT * FROM A
LEFT OUTER JOIN B ON A.ID = B.A_ID
AND B.F_ID = 3
JET-SQL (what I h...
Can anyone of you help me understand the behavior I get when visiting this page?
<html>
<body>
<?php
$liendb = mysql_connect("localhost","","");
mysql_select_db ("test");
for($i = 0; $i < 418; ++$i)
{
echo("Any old text<br />");
}
$resultatSQL = mysql_query("SELECT...
Is there a way this hand coded query could become dynamic?
SELECT master.id,
(select count(0) as score1 from scores where scores.id = master.id AND scores.category = '1'),
(select count(0) as score2 from scores where scores.id = master.id AND scores.category = '2'),
(select count(0) as score3 from scores where scores.id = master.id AND ...
I have a MySql database with a users table. In this table is a random token that is being used for security reasons. Until now, we have been adding users by manually adding rows; The token was created using MD5(Rand()).
I will now be adding users programmatically doing something like principal.setToken(whatever). What is the easiest wa...
I am loading a CSV file into MySQL (5.1) using CREATE TABLE and LOAD DATA. I have a number of columns which are textual types (categories) but contain numerical values. When I create the table I assign these columns as VARCHAR(254) but the JDBC driver throws a SQLException "Data truncated for column AgeGroup at row 1".
My data looks l...
I have a query that has a very costly INDEX SEEK operation in the execution plan. In order to track down the cause i set IO STATISTICS on and ran it. In the problem section it gave the following statistics:
Table
'#TempStudents_Enrollment2_____________________________________000000004D5F'. Scan count 0, logical reads 60,
physi...
I recently tried to import a bunch of blog posts from an old blog (SharePoint) to my current blog (WordPress). When the import completed, a lot of nasty <div> tags and other HTML made it in to the content of the post, which screwed up the way my site was rendering.
I'm able to view the offending rows in the MySQL database and want to k...
I have data like this:
Task | Hours
1.1 | 40
2 | 40
2.1 | 60
2.1.1 | 15
15.9 | 24
16 | 5
19.1 | 40
19.1.1 | 8
19.1.2 | 12
19.2 | 6
19.2.1 | 21
19.2.2 | 15
19.2.3 | 2
19.3 | 64
I would like to group based on the first two levels of the Task, producing this result...
Is there a way to step into the Stored procedure code in SQL Management Studio. I know this is possible with Visual Studio, but I am looking for a dependable debugging solution from within Management Studio
...
I need to be able to find all items in a table where the id of each item is not in a relational mapping table. In other words, I have one table where each row has an id. If that id is in a map table, it should not show up in my list.
I was thinking of querying my map table for all id's in it, then turning around and querying my main t...
Is there/has somebody any comparison, personal experience, or guideline when to use the text type instead of a large varchar in MySQL?
While most of the entries in my database will be less than 1000 characters, some might take up to 4000 characters or more. What is the limiting length of varchar which makes text a better variant?
I do ...
Hi, I copied a SQL Server database from one system to the next, identical setup, but completely different physical machine. I used Norton Ghost and recoverd files manually, for example, the entire SQL Server 2008 folder found in c:\Program Files after re-installing SQL Server 2008 Express.
One of my databases has AES_256 encryption ena...
Table
id int(11) No auto_increment Change Drop Primary Index Unique Fulltext
email varchar(45) latin1_swedish_ci No Change Drop Primary Index Unique Fulltext
billpayment tinyint(1) No Change Drop Primary Index Unique Fulltext
dispatch tin...