I have this SQL query that didn't return any rows. I checked those tables which contain data so I think my query is incorrect.
)]2]1
my query is:
SELECT payment_type,with_service_total,sale_nm
FROM `ospos_sales_payments`
INNER JOIN ospos_sales_items ON ospos_sales_payments.sale_id = ospos_sales_items.sale_id
WHERE 'sale_id' = '236'
The error is in your syntax. You are doing WHERE 'sale_id' = '236'
, so you are comparing two different strings, and this condition will always evaluate to FALSE
.
Your query should be written like this:
SELECT
payment_type,
with_service_total,
sale_nm
FROM `ospos_sales_payments`
INNER JOIN ospos_sales_items
ON ospos_sales_payments.sale_id = ospos_sales_items.sale_id
WHERE sale_id = '236'
Also, if the sale_id
field is numeric, you can compare to 236
also without using quotes.
Remove quote and add table name:
WHERE ospos_sales_payments.sale_id = '236'
or
WHERE `ospos_sales_payments`.`sale_id` = '236'
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I've got the following table months
I have a table called country_zones and theres a column called country which currently holds