Complete SQL Server noob here. I'm not sure how to go about finding an answer to as I'm mostly not sure what to begin searching.
I have BLOG
table in my SQL Server database that stores blog posts like so
ID Title DatePosted
-----------------------------------------------
1 Why Batman is Greater than Sup... 07/15/2017
2 10 Reasons Superman is the wor... 08/02/2017
3 Sick of Metropolis? Move to Go... 08/03/2017
I have another relational table that stores blogs that users have Liked, i.e.,
UserID PostID DateLiked
-------------------------------
232413 2 08/03/2017
232413 1 07/30/2017
234285 2 08/03/2017
Now what I'd like to do is call a simple SELECT *
on my BLOG
table, but pass in a UserID
as an argument to that query to determine if the Blog was liked by said user, so my Result set would look something like so.
Given User ID: 232413
ID Title DatePosted IsLiked
--------------------------------------------------------
1 Why Batman is Greater than Sup... 07/15/2017 1
2 10 Reasons Superman is the wor... 08/02/2017 1
3 Sick of Metropolis? Move to Go... 08/03/2017 0
Is this possible in SQL Server/Database? Any tips or helpful reading is VERY much appreciated!