Fixed query -> sql