Hi Friends,
It will be great if you help me to get a query for my expected result as follows:
Use the sql create table:
CREATE TABLE `tblbusiman` (
`WMC` varchar(15) NOT NULL DEFAULT '',
`Wnm` varchar(250) NOT NULL DEFAULT '',
`Intro` varchar(20) NOT NULL DEFAULT '',
PRIMARY KEY (`WMC`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1$$
Insert data are:
INSERT INTO `tblbusiman` (`WMC`,`Wnm`,`Intro`) VALUES ('A1','RAJU','CMP');
INSERT INTO `tblbusiman` (`WMC`,`Wnm`,`Intro`) VALUES ('A1A','RAJU WIFE 1','A1');
INSERT INTO `tblbusiman` (`WMC`,`Wnm`,`Intro`) VALUES ('A1AA','R-WIFE 1 SON','A1A');
INSERT INTO `tblbusiman` (`WMC`,`Wnm`,`Intro`) VALUES ('A1B','RAJU WIFE 2','A1');
INSERT INTO `tblbusiman` (`WMC`,`Wnm`,`Intro`) VALUES ('A2','BABU','CMP');
INSERT INTO `tblbusiman` (`WMC`,`Wnm`,`Intro`) VALUES ('A2A','BABU WIFE 1','A2');
INSERT INTO `tblbusiman` (`WMC`,`Wnm`,`Intro`) VALUES ('CMP','Company','C'); My expected/required Result (WMC): IF user select WMC = A1 THEN
A1A
A1AA
A1B
IF user select WMC=CMP THEN
A1
A1A
A1AA
A1B
A2
A2A
Note: i am using mysql db. but no matter about query.
Expecting your valuable reply
Regards,
Thiru.