Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. $query = "SELECT mqe.registration,
  2. COUNT(*) AS numberofenqs,
  3. COUNT(DISTINCT ucv.ip) AS unique_views,
  4. SUM(ucv.views) AS total_views
  5. FROM main_quick_enquiries AS mqe
  6. LEFT OUTER JOIN used_car_views AS ucv
  7. ON ucv.numberplate = mqe.registration
  8. WHERE mqe.registration IS NOT NULL
  9. GROUP BY mqe.registration ORDER BY numberofenqs DESC";
  10.  
  11. SELECT registration, COUNT(*) AS numberofenqs FROM main_quick_enquiries GROUP BY registration ORDER BY numberofenqs DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement