more work on the sql with data