Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. String queryString = "SELECT * FROM ( " +
  2. " SELECT " +
  3. " a_type as 'Contract Type', " +
  4. " name as 'Full Name', " +
  5. " lent_value as 'Credits', " +
  6. " '' as 'Payment Info' " +
  7. " FROM free_users " +
  8. " UNION " +
  9. " SELECT " +
  10. " type as 'Contract Type', " +
  11. " name as 'Full Name', " +
  12. " value as 'Credits', " +
  13. " payment_info as 'Payment Info' " +
  14. " FROM paid_users " +
  15. ") results " +
  16. "ORDER BY results.`Full Name` ";
  17.  
  18. Query query = entityManager.createNativeQuery(queryString);
  19.  
  20. query.getResultList();
  21.  
  22. String correctedQueryString = "SELECT * FROM ( " +
  23. " SELECT " +
  24. " a_type as 'Contract Type', " +
  25. " name as 'Full Name', " +
  26. " lent_value as 'Credits', " +
  27. " 'p' as 'Payment Info' " +
  28. " FROM free_users " +
  29. " UNION " +
  30. " SELECT " +
  31. " type as 'Contract Type', " +
  32. " name as 'Full Name', " +
  33. " value as 'Credits', " +
  34. " payment_info as 'Payment Info' " +
  35. " FROM paid_users " +
  36. ") results " +
  37. "ORDER BY results.`Full Name` ";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement