In Vtiger database where can i find the relation between tables vtiger_users and vtiger_contactdetails? - vtiger

I want to know contact's owner with a MySQL query.
I'm using Vtiger 7.1 with PHP 7 and MySQL 5.

The owner information is stored in the smownerid column of the vtiger_crmentity table. The contactid column for vtiger_contactdetails table is a foreign key for the crmid column in the vtiger_crmentity table.
For example, given a contact with record id = 1000, you will use the query as -
select * from vtiger_users where id=(select smownerid from vtiger_crmentity where crmid=1000)

Related

Aaggregate fact table sales based on a dim table column that are related through another dimension table in power BI

I have a situation, I want to get the reseller sales for "WASHINGTON REGION"; the database is "AdventureWorksDW2019" and I have the column relation as follows:
The geography details are populated in "DimGeography" table,
The reseller details are populated in "DimReseller" table, where each geography, say in my case, WASHINGTON could have more then reseller; hence, there is many-to-one relation between "DimReseller" and "DimGeography" and the column in relation is "GeographyKey"
The fact table "FactResellerSales" table is populated with reseller-sales; hence there is many-to-one relation between "FactResellerSales" and "DimReseller" tables; the column in relation is "ResellerKey"
--and the fact table has indirectly relation with "DimGeography" table
I am struggling generate a DAX query to get reseller-sales total belonging to "Washington"; could anyone help me understand to achieve this?
Thank you for giving your valuable time; pls find the screenshot of the schema diagram attached to this email.

Informatica | Update table with two primary keys

If target table has three columns as primary key, but you want to update the same table through informatica using only two columns from those primary key column?
How can we achieve this?

Query Google Big Query Table by today's date

I have query pertaining to the google big query tables. We are currently looking to query the big query table based on the file uploaded on the day into the cloud storage.
Meaning:
I have to load the data into big query table based on every day's data into cloud storage.
When i query:
select * from BQT where load_date =<TODAY's DATE>
Can we achieve this without adding the date field into the file?
If you just don't want to add a date column, Append current date suffix to your table name like BQT_20200112 when the GCS file is uploaded.
Then you can query specific datetime table by _TABLE_SUFFIX syntax.
Below is example query using _TABLE_SUFFIX
SELECT
field1,
field2,
field3
FROM
`your_dataset.BQT_*`
WHERE
_TABLE_SUFFIX = '20200112'
As you see, You don't need to add additional field like load_date when you query the tables using date suffix and wildcard symbol.

Create a Column to flag transactions that include a product

I have loaded 2 tables into the PowerBI data model:
TransactionLine Table: Unique Identifier is TransactionID + ProductID (see snapshot below)
Product Table: Unique Identifier is ProductID. That table also includes a ProductCategory field
So what I am trying to do is create a flag on the first table (TransactionLine Table) that will say if that TransactionID includes a product from Category A. To be more specific if even 1 line of a transactionID includes a product from that category, I want all lines for that transactionID to be flagged the same. So that flag column will look like the below

How to make a 1:1 relation between dates

I have a table about occupational accidents in a Company. This table have a date column about when this accidents happened. What I want to do is make another table about occupational accidents dates with day, month and year columns which is joined with the another table by the date I extracted from the Occupational accidents table (In my database known as OPS table.
I thought it would be easy but when i tried to do the relationship beetween OPS[Fecha](This is the field date from OPS table) and Date[ID](Date is how i called my new table and ID is the field joined with the another table), the relationship returns me as many to many what makes no sense because i think it should be 1 to 1.
This is what i did and my result:
1.This is the table I'm talking about.
I added as a new query:
Convert to table.
I changed the column name to ID
5.Then I try to make the relationship between these 2 tables waiting to get a 1 to 1 relation and I get this:
What I want to get is something like this relation:
When you add a new query and after converting it to a table, add a new step to remove duplicates(screenshot below). Once this is done you will be able to create a One-to-Many relationship between these 2 queries. But you CAN'T be able to create One-to-One.
Also, please search online on how relationships work in Power BI. I recommend this video: https://www.youtube.com/watch?v=-4ybWQSRcOY