I'm trying to rewrite these SQL queries into JPQL:
SELECT `payment_transactions`.*
FROM `payment_transactions`
INNER JOIN `wpf_payment_payment_transactions`
ON `payment_transactions`.`id` = `wpf_payment_payment_transactions`.`payment_transaction_id`
WHERE `wpf_payment_payment_transactions`.`wpf_payment_id` = 75
ORDER BY `payment_transactions`.`id` ASC
LIMIT 1
SELECT `payment_transactions`.*
FROM `payment_transactions`
INNER JOIN `wpf_payment_payment_transactions`
ON `payment_transactions`.`id` = `wpf_payment_payment_transactions`.`payment_transaction_id`
WHERE `wpf_payment_payment_transactions`.`wpf_payment_id` = 75
I tried to implement this:
SELECT t
FROM payment_transactions t
INNER JOIN wpf_payment_payment_transactions wppt
ON t.id = wppt.payment_transaction_id
WHERE wppt.wpf_payment_id = 1
ORDER BY t.id ASC
LIMIT 1
But I get error:
Unknown column 't' in 'field list'
Do you know how I can fix this?
Use * for select all the columns:
In your case you should use:
SELECT t.* from...