Hi there,
I am just confused in building a SQL query. I tried to run it in pieces successfully but just not able to build it as a whole.
This is the case: In table 'userseaches', user Rushi has been searched three times with different searchID's(primary key in 'searchtable') 10, 11, 12 . When searched with searchID 10 got 110 results, with 11 got 112 and with 12 got 115 results.
Now what I have to do is, get searches of ID's 11 and 12(latest two searches) i.e 112 and 115 and get the usernames of those users who are newly added in last search(112) i.e three users.
I tried this with small pieces but hard to make it in whole. please feel free to ask for details. a
Thank you in advance.
ok below are the 3 tables: table mastersearches having fields :
ID Name srchtime
1 aron 22:10:10
2 rushi 12:12:14
table usersearches having fields :
ID masterID Name nooffriends
1 2 rushi 110
2 2 rushi 112
3 2 rushi 115
table searchtable having fields :
ID searchID Name friends
1 2 mike 25
2 2 paine 51
.
112 2 kumar 87
113 3 bandy 23
.
227 3 ganua 15
ok.
Now I want to just fetch three newly added users for the searchID 3.
Now I tried with this : got two ID's with searches with this query:
select
Name
from
usersearches
where
searchID in (11, 12)
gave all the followers:
But not able to fetch that newly added friends.