This is an old revision of the document!


Database


Grant permissions

replace *.* with schema.table if needed

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost';

Many to Many Relationship Joins

SELECT 
  a.*
FROM 
  map_ads_categories m
  JOIN ads a ON (m.ad_id = a.id)
WHERE
  m.category_id = 28;
SELECT 
  *
FROM 
  map_ads_categories m
  JOIN ads a ON (m.ad_id = a.id)
  JOIN categories c ON (m.category_id = c.id)
WHERE
  c.id = 28;