Re: search multiple values field
Of Course if you have scenario above there will no result, from your post previously you ask how to search without lookup.
If i got situation like that i will change DB Schema with 2 options :
[b]1. WITH CHILD TABLE
//create fruit’s master table
CREATE TABLE fruit
(
id
INT(10) NOT NULL AUTO_INCREMENT,
fruits
VARCHAR(50) NULL DEFAULT NULL,
PRIMARY KEY (id
)
)
COLLATE=‘latin1_swedish_ci’
ENGINE=InnoDB
AUTO_INCREMENT=4;
//create parent table
CREATE TABLE buyer
(
id
INT(10) NOT NULL,
name
VARCHAR(50) NULL DEFAULT NULL,
PRIMARY KEY (id
)
)
COLLATE=‘latin1_swedish_ci’
ENGINE=InnoDB;
//create child table
CREATE TABLE buyer_shoping
(
id
INT(10) NOT NULL AUTO_INCREMENT,
buyer_id
INT(10) NOT NULL,
fruit
INT(10) NULL DEFAULT NULL,
PRIMARY KEY (id
),
INDEX FK__buyer
(buyer_id
),
CONSTRAINT FK__buyer
FOREIGN KEY (buyer_id
) REFERENCES buyer
(id
) ON UPDATE CASCADE ON DELETE CASCADE
)
COLLATE=‘latin1_swedish_ci’
ENGINE=InnoDB;
- WITHOUT CHILD TABLE
//other option without child table, BUT YOUR FIELD TYPE OF fruits HAS TO VARCHAR
CREATE TABLE buyer_without_child
(
id
INT(10) NOT NULL AUTO_INCREMENT,
name
VARCHAR(50) NOT NULL,
fruits
VARCHAR(50) NOT NULL,
PRIMARY KEY (id
)
)
COLLATE=‘latin1_swedish_ci’
ENGINE=InnoDB;
[/b]
if you choose option 2 you should choose Double Select and Fill in lookup setting “SELECT fruits FROM fruit”.
See attachment please.
suyono