Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- | id_img | id_immobile | id_utente | img_url | type | visible_website | visible_pdf | pdf_img_type | category |
- |--------|-------------|-----------|---------|---------|-----------------|-------------|--------------|----------|
- | 3 | 1 | 0 | 1.jpg | general | 1 | 1 | foto | foto |
- | id_immobile | type | id_utente |
- |-------------|------|-----------|
- | 1 | demo | 90 |
- SELECT
- immobili.id_immobile,
- CONCAT(SUBSTRING_INDEX(immagini.img_url, ".", 1), "_thumb.", SUBSTRING_INDEX(immagini.img_url, ".", -1)) as img
- FROM immobili
- LEFT JOIN immagini
- on immagini.id_immobile = immobili.id_immobile
- WHERE (immagini.type = "main" OR immagini.type = "general" OR immagini.type IS NULL)
- GROUP BY immobili.id_immobile
- ORDER BY immobili.data_inserimento DESC, immobili.data_aggiornamento DESC
- SELECT
- immobili.id_immobile,
- CONCAT(SUBSTRING_INDEX(immagini.img_url, ".", 1), "_thumb.", SUBSTRING_INDEX(immagini.img_url, ".", -1)) as img
- FROM immobili
- LEFT JOIN immagini
- AND immagini.id_immobile = immobili.id_immobile
- AND (immagini.type = "main" OR immagini.type = "general" OR immagini.type IS NULL)
- GROUP BY immobili.id_immobile
- ORDER BY immobili.data_inserimento DESC, immobili.data_aggiornamento DESC
- SELECT
- i.id_immobile,
- CONCAT(SUBSTRING_INDEX(im.img_url, '.', 1), '_thumb.',
- SUBSTRING_INDEX(im.img_url, '.', -1)) AS img
- FROM immobili i
- LEFT JOIN immagini im
- ON i.id_immobile = im.id_immobile AND im.type IN ('main', 'general')
- ORDER BY
- i.data_inserimento DESC,
- i.data_aggiornamento DESC;
Add Comment
Please, Sign In to add comment