public static String generateJoin(int type, String tableName, String[] tables, String[] from, String[] to) {
        final int nfinal = from.length;
        String query = "";
        /*SELECT * FROM t1 LEFT JOIN (t2, t3, t4)
        ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)*/
        query += getJoinType(type) + " JOIN (";
        for (String table : tables) {
            if (table.equals(tableName)) {
                continue;
            }
            query += table + ",";
        }
        query = Utility.removeLast(query);
        query += ") ON (";
        for (int i = 0; i < nfinal; i++) {
            query += from[i] + "=" + to[i];
            if (i != nfinal - 1) {
                query += " AND ";
            }
        }
        query += ")";
        return query;
    }