Charlie Clark <charlie@xxxxxxxxxxxxxx> writes: > I'm getting unexpected results on a query which involves joining two > tables on two common variables (firstname and lastname). That looks like it should work. Given that you describe the columns as "names" I'm supposing they are of textual datatypes. Maybe you have a messed-up encoding or locale situation that is causing the sorts to not work properly? What PG version is this exactly, on what platform, and what do "show lc_collate" and "show server_encoding" say? regards, tom lane