Click here to Skip to main content
15,887,373 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
C#
Write a query to display the names of the users who have posted posts and the contents of posts, sorted by name, then by post date and then by post content.

kindly send me the query coding for this.
i tried out this. but tits stating it to be a wrong answer.kindly help me with the right query coding.

What I have tried:

select user.name,post.content from user
inner join post
on user.id=post.user_id
order by user.name,date(date);
Posted
Updated 24-Apr-16 23:58pm
v2
Comments
Tomas Takac 25-Apr-16 5:22am    
Not enough information. What is the problem? Do you get an error message? If yes then what does it say? Or do the results differ form what you expect? If yes then what do you get and what do you expect to get?
Suvendu Shekhar Giri 25-Apr-16 5:31am    
Share the sample result set and what you want the result set to be.
Arunprasath Natarajan 25-Apr-16 5:47am    
select user.name,post.content from user
inner join post
on user.id=post.user_id
order by date(date) desc, user.name
Try this

1 solution

You have to write like :

select user.name,post.content from user
inner join post
on user.id=post.user_id
order by user.name,post.date,post.content;
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900