Hi there,
This is really causing me a headache:
I have a table which looks a little like the following structure (field names have been changed to protect the innocent):
CREATE TABLE `demo_table` (
`ID` bigint(20) unsigned NOT NULL auto_increment,
`fieldOne` text,
`fieldTwo` text,
`fieldThree` tinytext,
`fieldFour` tinyint(3) unsigned default NULL,
`fieldFive` datetime default NULL,
`fieldSix` text,
`fieldSeven` int(10) unsigned default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `ID` (`ID`),
KEY `ID_2` (`ID`)
) TYPE=MyISAM COMMENT='This is a test table';
Now thr problem is when I run a select statement I get an empty result set back if I only select one field. EG:
SELECT fieldTwo FROM demo_table
or
SELECT DISTINCT(fieldTwo) FROM demo_table
I get the right number of results back but the fields a totally empty. I ran it through .NET and using MySQL Front and they both return the same. However, if I do this:
SELECT ID, fieldTwo FROM demo_table
then I get all the right stuff back. However:
SELECT fieldTwo, ID FROM demo_table
doesn't work.
Basically it appears that only if you specify ID as the first column to select does it return a filled results set.
This seems like a really basic problem to me, but I've never come across anything like this before (I'm more of a MS SQL person though!)
Thanks a lot for your help!!
This is really causing me a headache:
I have a table which looks a little like the following structure (field names have been changed to protect the innocent):
CREATE TABLE `demo_table` (
`ID` bigint(20) unsigned NOT NULL auto_increment,
`fieldOne` text,
`fieldTwo` text,
`fieldThree` tinytext,
`fieldFour` tinyint(3) unsigned default NULL,
`fieldFive` datetime default NULL,
`fieldSix` text,
`fieldSeven` int(10) unsigned default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `ID` (`ID`),
KEY `ID_2` (`ID`)
) TYPE=MyISAM COMMENT='This is a test table';
Now thr problem is when I run a select statement I get an empty result set back if I only select one field. EG:
SELECT fieldTwo FROM demo_table
or
SELECT DISTINCT(fieldTwo) FROM demo_table
I get the right number of results back but the fields a totally empty. I ran it through .NET and using MySQL Front and they both return the same. However, if I do this:
SELECT ID, fieldTwo FROM demo_table
then I get all the right stuff back. However:
SELECT fieldTwo, ID FROM demo_table
doesn't work.
Basically it appears that only if you specify ID as the first column to select does it return a filled results set.
This seems like a really basic problem to me, but I've never come across anything like this before (I'm more of a MS SQL person though!)
Thanks a lot for your help!!