I have two tables. One with the countries…
CREATE TABLE IF NOT EXISTS `tblcountry` (
`tblcountryid` int(11) NOT NULL AUTO_INCREMENT,
`code` char(2) CHARACTER SET utf8 NOT NULL,
`en` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`de` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
UNIQUE KEY `tblcountryid` (`tblcountryid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
And one with locations (plants):
CREATE TABLE IF NOT EXISTS `tblplant` (
`tblplantid` int(11) NOT NULL AUTO_INCREMENT,
`tblcountryid` int(11) NOT NULL,
`plantname` varchar(255) NOT NULL,
`plantidnr` varchar(255) NOT NULL,
PRIMARY KEY (`tblplantid`),
KEY `tblcountryid` (`tblcountryid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Whe i make a form on tblplants with a number autocomplete field on tblcountryid to tblcountry with this lookup statement:
SELECT tblcountryid, sc_concat(de,' ', code)
FROM tblcountry
then the autcomplete not work. With this lookup
SELECT tblcountryid,de
FROM tblcountry
it works perfect!