SQL query to change text on export, but not in database - sql

I was wondering if there is a way to write an SQL query that would change text upon export but not in the database.
For example:
I have a query that exports a .csv file with prices and quantities for selling products online. Then I manually change a few products prices to cover online fees and then upload the file. What I would like to accomplish is having this built into the query so I can have it update automatically but I do not want the price to be changed in my database.
Is this possible?
Thanks, and let me know if you'd like additional clarification.

You can manually modify the select without affecting the data in the database. For example, if ordering shoes adds a 15% online fee, you could do the following:
SELECT
CASE WHEN [ProductType] = 'Shoes' THEN Price * 1.15 ELSE Price END AS OnlinePrice
FROM
[dbo].[Product]
If that doesn't help, can you provide a more concrete example of what you're trying to achieve?

Related

Impact on the price does not appear in prestashop CSV

I am using Prestashop 1.6 and I want to modify the prices with a CSV file but I can not do it since in the list of options per column I do not see the impact of Impact on the price.
I already tried with the price columns with IVA, price without IVA, etc. but no option modifies the price.
What I can do?
In fact this field does not exist, so either you get the old price, and you add the impact, or you directly add the new price, or you do a development yourself to handle this.
Regards

SQL mass updates on Volusion

Right now I am trying to update a field for a lot of products using SQL on Volusion but I can't seem to get it right.
I am trying to update the Package Type to UPS Package for every product but when I update it this way, it just adds another option on the drop down list titled the exact same thing
https://i.imgur.com/MhPmRIJ.png
I imagine what I should be doing is changing things around so that instead of updating every product I'm making every product choose UPS Package from the existing menu? If I manually change a product to UPS Package (correctly) then export all product data the field is displayed as just a '2' on the spreadsheet, but I also can't just put a '2' in on the mass update.
Thanks in advance
1:
Its the space before the SET value that is causing this, which you would need in order to keep this on the same line (otherwise this becomes products_joinedSET). This was a correction made to any SQL that can be run in a store that was made back in mid November. So any queries with a SET value will need a line break in order to remove that space between the table name and the SET.
UPDATE Products_Joined
SET Package_Type = 'UPS Package' WHERE ProductPrice = '0'
Of course, if you want to change ALL your products to UPS Package and have products that are more than $0.00 then you'll need to remove WHERE ProductPrice = '0'

When relating 3 entities in CRM 2011 using Advanced Find only 2 entities show up in edit columns

I'm trying to create a view in CRM 2011 that will show a few columns from Customers (Account), Orders (SalesOrder), and Order Products (SalesOrderDetail). I already know I need to start at the child-most entity so under Advanced Find I select "Order Products" under Look for. When I do this I'm able to select columns from Orders but unable to select columns from Customers.
Is this even possible to accomplish in CRM?
I'm trying to create the following result set:
Account.Name,
Account.Email,
SalesOrder.OrderNumber,
SalesOrderDetail.NetAmount,
SalesOrderDetail.ShipDate
I verified that you cannot manually add a second link within a view query. To my knowledge it is also not possible to add these columns though javascript. You can get the account name in your view simply by using the account lookup on the Order. If you need for the account email to also be in the view, then I suggest you add this field to the order entity and populate it with post callout logic on the account.
I Second Zach’s idea, but suggest adding a direct relationship between customer and orderdetail . This way you can use fetchxml to show account.email or any other account.* for that matter.
The downside is you’ll need to sync order.customer changes to orderdetail.customer.
The better option is to simply create a report and show that in an iframe or a webresource.
This is not possible even if we edit the fetch xml it wont work

Assign Tax Class to Products

I have (what I think is) a simple problem with my Magento tax classes. I have around 400 products in my shop and only 20 of them have a tax class assigned to it. I checked my database and the table "catalog_product_index_price" and all the products with the working tax have tax_class_id = 1 and all the not working ones have tax_class_id = 0.
So I thought I'll just update every product to tax_class_id = 1 and I'm done, but as soon as I re-indexed my prices in the Magento back-end the products got tax_class_id = 0 again.
Somewhere there must be a default, but I can't find it anywhere.
catalog_product_index_price is an index table, which is populated during reindexation process. It means that it pulls data from other tables and group them in this table for further use. That's why your changes were overridden after the reindex.
If you want to change tax_class_id for your products, the easiest option would be to use Mass Update* functionality in your admin panel. Open Manage Products section, select all products (select all), choose Update Attributes from action dropdown, and you'll be able to change Tax Class for all the products at once.
Try change it by hand by going to Catalog -> Manage Product -> Click on one -> Prices -> Tax Class.
Then have a look how it changes in the back end.
select * from catalog_product_index_price where entity_id = [[product_id]];
Best bet from here is to trace the SQL statement by changing pdo debug on by logging the sql statements: http://yauhen.yakimovich.info/blog/2011/03/21/log-all-sql-queries-in-magento/

Oracle PL/SQL - Generate Invoice

I have a basic database for a shop with product, sales and customer tables. I need to generate an invoice for each customer every 3 months to show the customers total expenditure.
What I'm not sure about is the way to go about this. Should I have an invoice table?
Any help or tips greatly appreciated.
How about creating a view based on a select statement using those tables. Then just refer to the view. You can also create a stored procedure or function that accepts an input like customer ID. I'd go with the view route personally.
Yes
What invoices you've generated is valuable information that you don't want to lose. How else do you know who's paid which invoice?
You want to be able to say exactly what invoices you've sent out, the value of those invoices and exactly what items they correspond to.
Personally not only would I have an invoice table but an invoice items table as well.