Thread: MySQL HELP

Results 1 to 3 of 3
  1. #1 MySQL HELP 
    Member MySQL HELP Market Banned

    Join Date
    May 2011
    Age
    29
    Posts
    414
    Thanks given
    16
    Thanks received
    44
    Rep Power
    56
    I know there might not be many people on this forums with MySQL experience but it's worth trying to look for some help.

    I've got this query and I'm trying to work out how to change it so that it Limits the results to X amount of rows per each meeting.id

    for an example show only 2 results per each different meeting.id

    Code:
        SELECT meeting_appointment.* FROM `meeting` 
        INNER JOIN meeting_appointment ON ( 
            meeting_appointment.meeting_id = meeting.id AND meeting_appointment.pupil_id = 0 AND meeting_appointment.guardian_id = 0 AND meeting_appointment.deleted = 0 
        ) 
        WHERE ( 
            meeting.grade_id = "-1" OR meeting.grade_id IN ('87') 
        ) 
        AND meeting.startTime < '2016-10-06 14:00:00' + INTERVAL 1 HOUR AND meeting.startTime > '2016-10-06 14:00:00' - INTERVAL 1 HOUR
    	
        GROUP by meeting_appointment.id 
        ORDER BY meeting_appointment.startTime ASC
    Reply With Quote  
     

  2. #2  
    Web Developer & Designer

    IlluZive's Avatar
    Join Date
    Mar 2014
    Age
    28
    Posts
    305
    Thanks given
    163
    Thanks received
    202
    Rep Power
    404
    just add LIMIT and then the number of rows you want to return at the end of the select query
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Oct 2009
    Posts
    438
    Thanks given
    29
    Thanks received
    108
    Rep Power
    0
    The limit clause limits the number of results returned in your sql statement.
    Code:
    SELECT
         column
    FROM
         table
    LIMIT 10
    would return the first 10 rows of your table.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Setting up mysql help.
    By rmb7 in forum Help
    Replies: 0
    Last Post: 03-01-2009, 08:19 PM
  2. MySQL help
    By myK- in forum Help
    Replies: 3
    Last Post: 02-18-2009, 02:33 AM
  3. Mysql Help
    By Nikki in forum Application Development
    Replies: 2
    Last Post: 01-24-2009, 06:53 AM
  4. MYSQL help really quick.
    By myK- in forum Help
    Replies: 1
    Last Post: 01-16-2009, 10:05 PM
  5. free play mysql help
    By xxx123xxx in forum Help
    Replies: 0
    Last Post: 11-11-2008, 02:09 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •