Jump to content

Recommended Posts

I want to pull out a row from a table by its primary ID, then join another table which has multiple rows with the same ID as the primary, but not unique

 

table 1:

id-1

id-2

id-3

 

table 2:

ticketID-1

ticketID-1

ticketID-1

ticketID-2

ticketID-3

ticketID-3

 

Link to comment
https://forums.phpfreaks.com/topic/165375-group-by-order/#findComment-872230
Share on other sites

Hmm yes, although trying your example with new fields,database It does not work

 

Heres what I have got so far

 

	SELECT t.id, t.subject, t.department, tm.responder, tm.date
	FROM fred.client_tickets t 
	INNER JOIN
	(
		SELECT date, responder
		FROM fred.client_ticket_messages
		GROUP BY ticketID
	)
	AS tm USING ( date, responder )

 

Error: Unknown column 'date' in from clause

Link to comment
https://forums.phpfreaks.com/topic/165375-group-by-order/#findComment-872893
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.