Hi i have the following sql which works perfectly in a form but when i try to use the same in report it is not working
secondly how do we compare date when the field is time stamp ?
SELECT *
FROM customer
INNER JOIN transaction on customer.customer_id = transaction.tra_customer_id
LEFT JOIN transaction_item on transaction_item.tri_transaction_id = transaction.transaction_id
LEFT JOIN tbl_batch on tbl_batch.batch_id = transaction_item.batch_id
===============================================>
$toDate = msql_date_nq('#vTo#');
$fromDate = msql_date_nq('#vFrom#');
$sql =
<<<EOSQL
CREATE TABLE #dataTable#
SELECT *
FROM customer
INNER JOIN transaction on customer.customer_id = transaction.tra_customer_id
LEFT JOIN transaction_item on transaction_item.tri_transaction_id = transaction.transaction_id
LEFT JOIN tbl_batch on tbl_batch.batch_id = transaction_item.batch_id
EOSQL;
nuRunQuery($sql);
---------------------------------------------->
help would be very much appreciated
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Help on time stamp and reports
Re: Help on time stamp and reports
at_rcc,
I think your first problem might be because using * will use every field, but if you do this with CREATE TABLE, you might have the same named fields somewhere within the tables transaction_item, customer, tbl_batch or transaction, and you can't create a table with duplicate fieldnames.
Secondly use format_date() in mysql http://dev.mysql.com/doc/refman/5.1/en/ ... ate-format
SELECT DATE_FORMAT( '1997-10-04 22:23:00' , '%Y-%m-%d' )
Steven
I think your first problem might be because using * will use every field, but if you do this with CREATE TABLE, you might have the same named fields somewhere within the tables transaction_item, customer, tbl_batch or transaction, and you can't create a table with duplicate fieldnames.
Secondly use format_date() in mysql http://dev.mysql.com/doc/refman/5.1/en/ ... ate-format
SELECT DATE_FORMAT( '1997-10-04 22:23:00' , '%Y-%m-%d' )
Steven
A short post is a good post.
-
- Posts: 32
- Joined: Thu Sep 02, 2010 11:19 am