1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
DROP PROCEDURE `getHorse`|
CREATE DEFINER=`root`@`localhost` PROCEDURE `getHorse`(IN id_ad INTEGER)
BEGIN
SELECT ad.addate, ad.adcity, ad.id_departments, ah.horsename, ah.yearofbirth, ah.liste, ah.registered, ah.sire, ah.mother, ah.pp, ah.ppp, ah.ppm, ah.pm,ah.pmp, ah.pmm,
ah.mp, ah.mpp, ah.mpm, ah.mm, ah.mmm, ah.mmp, ah.price, ah.price2, ah.earnings,sl.name_stallions_list, d.name_department, cou.name_country, s.currency_text, ama.firstname AS member_firstname, ama.lastname AS member_lastname, ama.email AS member_email, ama.phone AS member_phone, ama.mobile AS member_mobile,
ama.fax AS member_fax, ama.city AS member_city, ama.postcode AS member_postcode
FROM Ads AS ad
JOIN ad_horses AS ah ON ad.id_ad = ah.id_ad
JOIN departments AS d ON ad.id_departments = d.id_departments
JOIN counties ON d.id_counties = counties.id_counties
JOIN countries AS cou ON counties.id_countries = cou.id_countries
JOIN sites AS s ON ad.id_sites = s.id_sites
JOIN ads_member_address AS ama ON ama.id_ad = ad.id_ad
LEFT OUTER JOIN stallions_list AS sl ON ah.id_stallions_list = sl.id_stallions_list
WHERE ad.id_ad = id_ad;
END| |