Limit columns from QuickBooks Online API Customer Query - php

I know I can do something like:
SELECT * FROM Customer
which returns the following objects.
Active
AlternatePhone
Balance
BalanceWithJobs
BillAddr
BillWithParent
CompanyName
CurrencyRef
DefaultTaxCodeRef
DisplayName
FullyQualifiedName
Id
Job
MetaData
PreferredDeliveryMethod
PrimaryEmailAddr
PrimaryPhone
PrintOnCheckName
ShipAddr
SyncToken
Taxable
I tried limiting my query to:
SELECT Id FROM Customer which worked great, but for some reason I cannot do:
SELECT ShipAddr FROM Customer. No data is returned.
I've learned SELECT DisplayName, Id FROM Customer works but nothing else does.
Is there a way I can request the following data only and nothing else:
SELECT AlternativePhone, BillAddr, CompanyName, DisplayName, Id, PrimaryEmailAddr, PrimaryPhone, ShipAddr FROM Customer?

I do not think fetching only selective fields is supported for all fields.
You can try your queries on API explorer and see if get the resultset you want. Else, please consider it as non-supported.
You will have to get the full response in that case then and use the selected fields/properties.

Related

How to fetch all the records and display info on the right. Depending on value from database

I am trying to send a request form to the local warehouses. This request has an ID (request ID). The form contains shortlisted warehouses (as products because these warehouses will only stock that specific product). Depending on the request, chk boxes are ticked and the form is submitted to those specific warehouses. The warehouse users, then fill the form by selected yes or no and submits the form again to us.
So far I am able to to get the form but I am not able to link the results returned back to this request ID. RequestID is the PK of Request table and FK in SendRequest Table.
A request can be send more than 1 time in a day by the same user or many users to find out if the stock has arrived.
Normal left join query fetches the results, but the status yes/no gets linked with other request ID as well.
I also tried with left join query by using the where clause to the requestID, then the form to send the request gets disappeared.
Any clue what I am doing wrong here?
Thanks.
query:
Select request.ID, request.Name, request.Phone, request.email,
request.Disabled, request_request_status.r_id,
request_request_status.comments,
FROM request
LEFT JOIN request_request_status on request_request_status.r_id = request.ID
WHERE request.Disabled = 0 and request.shortList = 1
Order by request.Name ASC
You should try this:
DB::table('carrier')->select('carrier.ID','carrier.Name', 'carrier.Phone', 'carrier.email',
'carrier.Disabled', 'request_request_status.r_id','request_request_status.comments')
->join('request_request_status', 'request_request_status.r_id', '=', 'carrier.ID')
->where('carrier.Disabled','=',0)
->where('carrier.shortList','=',1)
->orderBy('carrier.Name', 'asc')
->get();

Querying PurchaseOrderNumber returns all PurchaseOrders

I'm trying to query for a specific purchase order using the "PurchaseOrderNumber" field, however regardless of what value I provide, all PurchaseOrders are returned.
I've replicated the exact same code except swapped out for Invoices and the querying of "InvoiceNumber" works fine, just not PurchaseOrders.
Here's the URL I'm calling:
https://api.xero.com/api.xro/2.0/PurchaseOrders?where=PurchaseOrderNumber%3D%3D%22PO-0007%22
You can query purchase orders both by Id and Purchase order number.
So your request would look something like
api.xero.com/api.xro/2.0/PurchaseOrders/PO-0001
PO-0001 can be substituted by the actual id as well.
Look at xero documentation here, and the optional parameters section.
Hope this helps.

MySQL: Select data from numerous sources, consolidate into one response - shopping cart migration

I'm really struggling on this. I'm migrating from one shopping cart CMS to another. I've got to move the past orders data. The database's are structured differently so I need to script the migration. The SQL query I'm coming up with is:
SELECT tblCustomers.*, tblAddress_Book.*,
(SELECT GROUP_CONCAT(orders_id) FROM orders WHERE customers_id = tblCustomers.customers_id)
FROM customers as tblCustomers
JOIN address_book as tblAddress_Book
ON tblCustomers.customers_id = tblAddress_Book.customers_id
Ideally what I'm looking to do is to pull the data in a format as such
all columns from customer's table, all columns from address book in relation to customer's id, the orders made in relation to customer's id if exists, I need to join the data from orders table into one cell per customer id
I still want to grab the customers that didn't make orders as well.
I hope I explained that clearly enough. I've been searching and tinkering with it for hours but I'm not getting any closer. Hopefully someone can help

SQL Query to find total number of orders placed by customer

I am having trouble in writing a SQL query for php query, (for the Premiere Product Database). I have to get the total number of orders placed by a customer for a given customer number.
SELECT customername, firstname, lastname, COUNT(DISTINCT(customernum))
FROM customer, orders, rep
WHERE customer.customernum=orders.customernum
ANDcustomer.repnum=rep.repnum AND customer.customernum=customernum;
The code above gives me an error message "#1052 - Column 'customernum' in field list is ambiguous".
This means two or more of the tables concerned in your query have a field called customernum and it doesn't know which you're referring to. Prefix it with the table name.
COUNT(DISTINCT(your_table_name.customernum))
It worked when I removed the DISTINCT and customer.customernum=customernum; parts. Thank you

Database Select Query Confusion

I need to keep all purchases from a single client together on a database table (It will be atored in my Orders table) and once someone is browsing a product, the system will search the dB for clients that bought that product and recommend the other products they bought (you will need to check for popularity of the other products and avoid repetition)
The data will be stored in a mysql database in a table called Orders. I then need to be able to search that database to see if other people have bought this product and if so which products they also bought.
So I've come up with this query
SELECT ProductName FROM Orders
(I have little knowledge and would like to no if I am on the right track)
I need to keep all purchases from a single client together on a database table
For this one you probably need to create a horizontal view (restricting by the client id you need to monitor the purchases) CREATE VIEW.
Could you provide your database schema ? in order to create the query you need you should join many tables, so it would be easier to provide the schema and how your tables are tied together.
try this
SELECT ProductName
FROM Orders WHERE client_id in
(SELECT client_id
FROM Orders
WHERE productname="ProductName ");

Categories