Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8155755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:45:23+00:00 2026-06-06T16:45:23+00:00

I have two tables: tickets ticket_id, int(11), NO, PRI, , auto_increment order_num, varchar(45), NO,

  • 0

I have two tables:

tickets

ticket_id, int(11), NO, PRI, , auto_increment
order_num, varchar(45), NO, , , 
user_id, int(11), YES, , , 
event_id, int(11), YES, , , 
number_of_tickets, varchar(4), YES, , , 
order_placed, timestamp, NO, , CURRENT_TIMESTAMP, 
payment_recd, enum('Yes','No'), YES, , No, 
payment_time, timestamp, YES, , , 

events

event_id, int(11), NO, PRI, , auto_increment
venue_id, int(11), YES, , , 
event_date, date, YES, , , 
event_time, time, YES, , , 
event_price, decimal(4,2), YES, , , 
event_capacity, int(11), YES, , , 
dateadded, timestamp, NO, , CURRENT_TIMESTAMP, 

I need to list tickets bought by a user and order by the event date but the following I’m trying is not doing the sort by correctly

select tickets.order_num as ordnum, tickets.event_id as tickid, tickets.number_of_tickets as numtix 
   from tickets, events
where  ((tickets.user_id = '1') and (tickets.payment_recd = 'Yes'))
  group by tickets.order_num 
order by events.event_date asc

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:45:25+00:00Added an answer on June 6, 2026 at 4:45 pm

    you are not joining the tables, so it will list all rows from both tables, try:

    select tickets.order_num as ordnum, tickets.event_id as tickid, tickets.number_of_tickets as numtix 
    from tickets
    inner join events on tickets.event_id = events.event_id
    where ((tickets.user_id = '1') && (tickets.payment_recd = 'Yes'))
    group by tickets.order_num order by events.event_date asc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables CREATE TABLE table1 (id int primary key auto_increment,....); CREATE TABLE
I have two tables: article('id', 'ticket_id', 'incoming_time', 'to', 'from', 'message') ticket('id', 'queue_id') where tickets
I have two tables: CREATE TABLE tblEatables ( `EatId` int UNSIGNED PRIMARY AUTO_INCREMENT, `Fruits`
I have these two tables tickets - id, user_id, manager_id etc users - id,
I have two tables user table user_id | name | 1 | peter |
I have two tables in MS Access. Table 1: users ID (auto int) Name
I have a database with two tables, events and tickets . The events table
I have two tables with the following columns: table1: id, agent_name, ticket_id, category, date_logged
I have two tables images2 and image_data So the goal is to have 1
I have two tables 1.Products prod_id prod_name 1 honda 2 hero 3 marcedes 4

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.