i have three table i attached db files with query result i am getting. my query is below

select tts.transaction_id,tts.service_type,tt.theme_name from transactions tts
inner join users tu on tu.user_id=tts.user_id
inner join themes tt
where tts.user_id =  71 
and tts.service_type in ('purchased','startup_service')
group by tts.theme_transaction_id;

i am not getting write theme name user_id 71 purchase.
when user purchase services there is no theme_id available so it's 0 but if theme purchase then theme id will be there.
hope any one can expain write approch or query. thanks

65f5040b1fb7ea40ad2946bbc77ef79a
052e76b6b780451d45ee1117d7c87732b92c799cb5ef24244dea8ba7ba65ecc444ca21f5ee3a357f4f3b7b77f66019b8

Hmm... Is the query exactly what you used? Well, why do you need 'group by' when what you are trying to group is already unique in its own? Also, I prefer to use like instead of in if the condition is not dynamic (predefined). My attempt is below...

SELECT tts.theme_transaction_id, tts.service_type, tt.theme_name
FROM tts left join tt on tts.theme_id=tt.theme_id
WHERE tts.user_id=71 and
      (tts.service_type like 'purchased' or
      tts.service_type like 'startup_service')
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.