Who is the friend of Zach with longest year relationship?
CREATE TABLE PersonFriend (friend VARCHAR, name VARCHAR, YEAR INTEGER)
SELECT friend FROM PersonFriend WHERE name = 'Zach' AND YEAR = (SELECT MAX(YEAR) FROM PersonFriend WHERE name = 'Zach')
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE PersonFriend (friend VARCHAR, name VARCHAR, YEAR INTEGER) Question: Who is the friend of Zach with longest year relationship? [/INST] SELECT friend FROM PersonFriend WHERE name = 'Zach' AND YEAR = (SELECT MAX(YEAR) FROM PersonFriend WHERE name = 'Zach') </s>