'include' data from two tables with same column name in single query - parse-platform

I have two tables(Reviews and Comments) with same column name userId, how can i differentiate them in parseQuery so i may get the data using the 'include' option, query is as follow:
query.whereEqualTo("businessId", parseBusiness);
query.include("userId"); // from the reviews table
query.include("lastComment");
query.include("userId"); // from he comments table
userId is a pointer to the User table

Related

Fetch Parent & Child records Quickbase API_DoQuery

I have a table A and Table B.
A is parent of B
What I want to do is perform a quickbase API call API_DoQuery to get the records in table A with all child records, something like this
id,
name
child:[id, name]
how can I do that right now I only got the values in table A and a number in the relation field
.
What I need to do ?
Thanks.
You can use a Combined Text summary field on the parent table to pull all child values into a single comma separated field on the parent table. Since Combined Text fields only work with strings, the Name field should work fine, but for the Record ID you need to first convert that to a string (text) in a new formula text field on the child table.
Summary field on parent:
Formula field to convert Record ID from numeric to string:

Are correlated sub queries supported by GraphQL

I am investigating the use of GraphQL
I have a use case which I cannot see how to achieve in a single GraphQL query.
I have the following data classes.
Type A Reference Data (Primary Key id)
Type A User Data (Foreign Key rd_id)
Type B User Data
I can execute three separate queries to retrieve all the necessary data
What I would like is to execute a single query and get all data
I can get Type A & B User data in one query fine.
However I also need the Type A Reference data returned with the associated Type A User Data.
Type A user data has a foreign key to the specific reference data row
I cannot see how I can write a GraphQL query that joins data from two separate types of data.
query experiment {
userA {
id
rd_id
name
address {
address_line_1
address_line_2
zip
}
}
userB {
id
business_name
trading_as
}
referenceData (id : $userA.rd_id) { // How can I achieve this join
type
type_name
limit
}
Does GraphQL allow me to join referenceData records to UserA type records like this in a "dynamic" way?

How to get distinct single column value while fetching data by joining two tables

$data['establishments2'] = Establishments::Join("establishment_categories",'establishment_categories.establishment_id','=','establishments.id')->where('establishments.city','LIKE',$location)->where('establishments.status',0)->whereIn('establishment_id',array($est_data))->get(array('establishments.*'));
this is controller condition.
I have two tables, in table1 i am matching id with table2 and then fetching data from table1, and in table2 i have multiple values of same id in table 1. i want to get data of table1 values only one time, but as i am hvg multiple data of same id in table2 , data is repeating multiple times, can anyone please tell me how to get data only one time wheater table2 having single value or multiple value of same id... thank you
you can do it by selecting the field name you desired
instead get all field from table establishments
$data['establishments2'] = Establishments::Join("establishment_categories",'establishment_categories.establishment_id','=','establishments.id')->where('establishments.city','LIKE',$location)->where('establishments.status',0)->whereIn('establishment_id',array($est_data))->get(array('establishments.*'));
you can select specific field from table establishments like
$data['establishments2'] = Establishments::Join("establishment_categories",'establishment_categories.establishment_id','=','establishments.id')->where('establishments.city','LIKE',$location)->where('establishments.status',0)->whereIn('establishment_id',array($est_data))->get('establishments.fieldName');
or you can also do
$data['establishments2'] = `Establishments::Join("establishment_categories",'establishment_categories.establishment_id','=','establishments.id')->where('establishments.city','LIKE',$location)->where('establishments.status',0)->whereIn('establishment_id',array($est_data))->select('establishments.fieldName')->get();`

Save on different tables using Eloquent Laravel Relationships

Hi I have 3 tables "temp_quotes", "quotes" and "quote_items"
Every quote generated goes to the "temp_quotes" table at first.
At the end of my multi-step form I need the following:
1- Receive all the quotes from the "temp_quotes" table, send it to the "quote_items" table and delete it from the "temp_quotes" table
2- Generate a new entry in the "quotes" table referencing the "users" table and
the "quote_items" table
Here is all the data and how needs to be save/removed on the tables:
temp_quotes Table
ID
BRAND
MODEL
YEAR
quotes Table:
ID
USER_ID
QUOTE_ID
quote_items Table:
ID
QUOTE_ID
BRAND
MODEL
YEAR
Any help will be appreciated.

SSAS - Creating named calculation from different tables

I am having troubles when i want to create a named calculation from two different tables.
I have the table "CallesDim" with an id(PK) and a description and the table "UbicacionesDim" with an id (PK), another id (FK to "CallesDim") and a description:
--
CallesDim
id PK
Descripcion VARCHAR
--
UbicacionesDim
id PK
CalleId FK to id from CallesDIM
Altura INT
--
I want to concatenate "Descripcion" from "CallesDim" with Altura from "UbicacionesDim".
I try doing this:
CallesDim.Descripcion + ' ' + CONVERT(VARCHAR,UbicacionesDim.Altura)
but i am having the following error:
the multi-part identifier "CallesDim.Descripcion" could not be bound
Any ideas?
Thanks!
In a named calculation you can only access columns from the table that it is defined on.
Which record of the other table should it take in case it would accept columns from other tables? How should it join? All this cannot be configured.
If you need to join two (or more) tables, you can define a named query that can contain joins and access as many tables as you like. A named query can contain everything that you can state in a single select statement.

Resources