i only want latest orderDate By userId from OrderPayment table where identifier='M' and PaymentStatus=succesfullenter image description here.Please guide me
Related
I am actually trying to make a matrix table using Oracle Analytics tool and PL/SQL.
Let's say i have a query which has in select statement variables Employee, Description, orderid ,amount and is grouped by Employee, Description. Orderid and amount belong to the same group. From this query i want extract the sum of the amount of each description from all employees. Do you have any idea how i can do this?
Thank you.
Edit:
Let's say we have the following query:
Select Employee, Description, orderid ,amount
From Employees
Group by Employee,Description
I want to extract the sum of amount from each Description group but from all Employees.A way to do this could be like this:
Select Description,sum(amount)
From Employees
Group by Description
But the actual query is much more complex and if i choose to make another query for finding the sum of each description i have to link it somehow to the first query to be able to show the results at the report.
Do you have any idea of a way to do this through oracle analytics publisher?
Thank you.
Select coalesce(Employee,'ALL_EMPOYEES'), coalesce(Description,'ALL_DESCRIPTION'), orderid ,amount
From Employees
Group by ROLLUP (Employee,Description)
Select coalesce(Employee,'ALL_EMPOYEES'), coalesce(Description,'ALL_DESCRIPTION'), orderid ,amount
From Employees
Group by CUBE (Employee,Description)
I would like to retrieve the Name of the Parent from the Cildren Id in a query thanks to the ORACLE feature "CONNECT BY"
SELECT contact_id, contact_name,parent_id, LEVEL
FROM contacts
CONNECT BY PRIOR contact_id = parent_id;
But I would like also retrieve the name of the parent, and I try many times, but I cannot obtain that I want. Could you please help me with that ?
You can use PRIOR with name column as well.
SELECT contact_id, contact_name,parent_id, LEVEL, prior contact_name
FROM contacts
CONNECT BY PRIOR contact_id = parent_id;
I have the following date which is in varchar2(11) column in database:
select valid_untill from SALES_ORDERS_V where header_id = 7999410;
30-May-2016
Using rtf template and xml source, the report output (PDF) is:
4950-11-19 04:45:49:0
I don't know its equal to "30-May-2016".
Why this is showing this, as I did not do any formating in rtf?
Not familiar with either RTF or XML-Publisher, but whenever you retrieve a date saved in string format, IF you use it as a date in your code and not as a string, you must make sure you retrieve it correctly.
In this case, with your select statement: it shouldn't be select valid-until from... (or is it really misspelled, with two l at the end: valid_until?) If it is meant to be used as a date, it should be
select to_date(valid_until, 'dd-Mon-yyyy') from ...
Really the problem here is that the date is stored as a string and not in the date datatype. Good luck!
Magento reviews follow this format:-
Summary
Body of Review
Date of Review
I need to change the date of the review to a custom date.
Please could somebody guide me on how to go about doing this? I have tried editing the review in the back-end, but the only sections I can change are the Summary and the Body of the review.
If you could let me know where in the database I should change, I'd really appreciate it. Or, if there is a way to change this in the back-end, without installing an extension, that'd be really awesome.
Preface
The Magento Admin backend does not have a place to edit the date of a product review. You must do this directly in the SQL database or programmatically.
The following instructions will help you change it directly in the SQL database.
1.) Find The Review ID
Login to your Magento backend Admin area and go here in the menu:
Magento Admin >> Catalog >> Reviews and Ratings >> Customer Reviews >> All Reviews
In the resulting table of all reviews, find the single review you want to change the date for. Do not click into the review because the ID is only shown in the table of all reviews.
Remember that ID
2.) Change the Date in the Database
I used PhpMyAdmin to get access to my Magento SQL database. You can use whatever SQL Management Platform suits you.
Login to your SQL database and navigate the the table named only 'review'.
In that table you will see a column called 'review_id'.
Find the row in the 'review.review_id' column that matches the ID of the review you want to change the Magento date for.
Click 'Edit' on that row and change the 'created_at' value of it.
Save your changes to the row by clicking 'Go'.
You're done.
Check Magento to make sure it displays the updated date.
Helpful Hints
The date value in 'created_at' must be in the format of an SQL date-time. This is 'YYYY-MM-DD hh:mm:ss'.
Magento is sensitive to timezones. You may need to adjust the date value you use to compensate for this - so it displays the way you want it.
The SQL 'review' table was not listed on my first page of table names in PhpMyAdmin. To find it, I had to click through to the second page of table names.
It is very easy to ruin your website by clicking the wrong things in PhpMyAdmin. So don't screw around in there.
I'd think by directly manipulating the reviews details from Databaes. Although this seems to be discouraged but since it may be one or two records, then creating a custom solution is not feasible.
Running this MySQL to fetch the reviews info from the DB may help you locate the review you are trying to edit.
SELECT
rd.`detail_id`,
rd.`review_id`,
r.`created_at`,
rd.`title`,
rd.`detail`,
rd.`nickname`,
r.`review_id`
FROM
`review_detail` rd
LEFT JOIN review r
ON rd.`review_id` = r.`review_id`
ORDER BY rd.`detail_id` DESC
You can set all Magento 1.x reviews to the order created date us this:
START TRANSACTION;
UPDATE review r INNER JOIN review_detail rd ON (rd.review_id = r.review_id AND r.entity_id = 1) INNER JOIN sales_flat_order_item oi ON (oi.product_id = r.entity_pk_value) INNER JOIN sales_flat_order as o ON (o.entity_id = oi.order_id) SET r.created_at = o.created_at;
SELECT r.review_id, r.created_at as review_date, o.created_at as order_date, o.increment_id, oi.sku FROM review r INNER JOIN review_detail rd ON (rd.review_id = r.review_id AND r.entity_id = 1) INNER JOIN sales_flat_order_item oi ON (oi.product_id = r.entity_pk_value) INNER JOIN sales_flat_order as o ON (o.entity_id = oi.order_id) GROUP BY oi.product_id ORDER BY r.created_at DESC;
COMMIT;
Tested and verified on Magento 1.9.x
I have a field that I would like to get the max value of but it is a varchar2(6) field, all numerals. I am unable to change the type of field
The field is a date listed like this 201307 for July 2013. Just using MAX does not work.
Using oracle.
SELECT MAX(date) "MostRecent" FROM tablename;
Should work. YYYYMM is going to sort as newest first in a MAX aggregate or analytic function in Oracle.