Re: [GENERAL] Selecting records with highest timestamp - for a join

2016-10-22 Thread Alexander Farber
Should I use LATERAL JOIN? On Fri, Oct 21, 2016 at 3:24 PM, Alexander Farber < alexander.far...@gmail.com> wrote: > > In PostgreSQL 9.5.3 I keep player infos from various social networks: > > # TABLE words_social; > sid | social | female | given | family | photo | place | stamp| > uid

Re: [GENERAL] Selecting records with highest timestamp - for a join

2016-10-21 Thread Alexander Farber
Please let me rephrase my question so that it is better understandable - In PostgreSQL 9.5.3 I keep player infos from various social networks: # TABLE words_social; sid | social | female | given | family | photo | place | stamp| uid ---+++-++---+

Re: [GENERAL] Selecting records with highest timestamp - for a join

2016-10-19 Thread David G. Johnston
On Wed, Oct 19, 2016 at 11:35 AM, Alexander Farber < alexander.far...@gmail.com> wrote: > I.e. a user can have several records in the above table, but I always use > the most recent one (the one with the highest "stamp") to display that user > in my game. > ​And if the second most recent has a pi

Re: [GENERAL] Selecting records with highest timestamp - for a join

2016-10-19 Thread Adrian Klaver
On 10/19/2016 12:44 PM, Alexander Farber wrote: > Adrian, for both player1 and player2 (because I need to display player > photos above the game board). > > SQL join with words_social - yes, but how to take the most recent record > from that table? > > For example there are user infos from Google

Re: [GENERAL] Selecting records with highest timestamp - for a join

2016-10-19 Thread Alexander Farber
Adrian, for both player1 and player2 (because I need to display player photos above the game board). SQL join with words_social - yes, but how to take the most recent record from that table? For example there are user infos from Google+, Facebook, Twitter - but the user has used Facebook to login

Re: [GENERAL] Selecting records with highest timestamp - for a join

2016-10-19 Thread Adrian Klaver
On 10/19/2016 11:35 AM, Alexander Farber wrote: Good evening, I have a question please on which kind of statement to use - In a table I store user info coming from social networks (Facebook, Twitter, ...): CREATE TABLE words_social ( sid varchar(255) NOT NULL, social integer N

[GENERAL] Selecting records with highest timestamp - for a join

2016-10-19 Thread Alexander Farber
Good evening, I have a question please on which kind of statement to use - In a table I store user info coming from social networks (Facebook, Twitter, ...): CREATE TABLE words_social ( sid varchar(255) NOT NULL, social integer NOT NULL CHECK (0 <= social AND social <= 6),