sql - Getting results from mutiple rows by comparing values in mutiple column in Mysql -


i want fixture list of club fixture table has fields of hometeam , awayteam when search returns first row match search parameter. yet want both fixtures when club playing @ home , away. here procedure

create definer=root@localhost procedure getclubfixtures(clubname varchar(45)) begin select fixturedate, tournament, hometeam, awayteam, kickoff  fixture seasonid in (select seasonid season seasontype=1)  , hometeam = clubname  or awayteam=clubname order fixturedate;

only one row returned shown below

'2013-05-15', 'fsl', 'sports club victoria university', 'villa sports club', 05:00:00

basically in version of procedure using

where seasonid in (select seasonid season seasontype=1)  , hometeam = clubname  or awayteam=clubname 

but think want this

where seasonid in (select seasonid season seasontype=1)  ,  (hometeam = clubname  or awayteam=clubname) 

hence try below procedure

create definer=root@localhost procedure getclubfixtures(clubname varchar(45)) begin select fixturedate, tournament, hometeam, awayteam, kickoff  fixture seasonid in (select seasonid season seasontype=1)  ,  (hometeam = clubname  or awayteam=clubname) order fixturedate; 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -