nofact noface

nofact noface

  • NA
  • 15
  • 1.6k

I fall in mistake Please help me my code not work correct

Jun 27 2015 6:47 AM

Hello every one

I fall in mistake

Please help me

I have 3 table

1 – User (id, email)

2 – Friend (sender, receiver, state)

3 – Post (sender, text, date)

Now

I want to select User (id), Post (*)

But

Select user’s post who is login and the other guy that receive a request for follow from the user and my code is:

Create PROCEDURE showpost

@email nvarchar (50)

AS

BEGIN

Select User.Code as code, post.* from post, friend, User where (User.email=post.sender) and ((friend.sender=@email or friend.reciver=@email) and state='ok' and (post.sender=friend.sender or post.sender=friend.reciver)) order by post.code desc

END

This is a problem

When show post the user’s post will be Repeated as many as his request for follow

Attached file is better

http://s6.uplod.ir/i/00629/4m2dkharb1oe.png
 

Answers (5)