Writing SQL queries has nothing to do with VB.NET, even if they're being executed from a VB.NET application. SQL is database programming and therefore questions regarding it belong in the Database Development forum.