Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 23/11/2024 Black Friday 2024

    BIG SALE, 30% discount for all our extensions. Use BF24 coupon code. Hurry up the discount is valid till 3 December.

  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Pull data from two different tables into one
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Pull data from two different tables into one
#23440
Pull data from two different tables into one 12 Years, 10 Months ago Karma: 0
Hi there, thanks for a great solution and support, my question is now (excuse my ignorant).

I need to pull data from two different tables and filter by user id and make FULL JOIN, I have read you post regarding similar thing but after try didnt work for me.

This is the query I hope to use:

SELECT jos_tipster_pro.Deporte, jos_tipster_pro.Fecha, jos_tipster_pro.Rival1, jos_tipster_pro.Rival2, jos_tipster_pro.Cuota
FROM jos_tipster_pro
FULL JOIN jos_tipster_deltio
ON jos_tipster_pro.Tipster=jos_tipster_deltio.tipster_id
ORDER BY jos_tipster_pro.Tipster
WHERE Tipster=1

(I want to show only data from specific user or Tipster)

I cant make it work in Ari Data Tables, please help.
Thanks
Tato
The administrator has disabled public write access.
 
#23450
Re:Pull data from two different tables into one 12 Years, 10 Months ago Karma: 760
Hello,

Could you specify how "jos_tipster_pro" or "jos_tipster_deltio" table is related to users?

PS: It is possible to use {$UserId} predefined variable in WHERE clause. For example it will look like:

...
WHERE user_id = {$UserId}
...

{$UserId} will be replaced with ID of logged user.

Regards,
ARI Soft
The administrator has disabled public write access.
 
#23451
Re:Pull data from two different tables into one 12 Years, 10 Months ago Karma: 0
Thanks for fast reply!

The thing is both tables have user id field but named differently one is called "Tipster" and the other is "tipster_id" both are same user but I need to filter the data by this so only show data from the tipster I want and collect this fields

In other words I need to put toghether this two querys but I dont know how to in order to show in a table one per line and ordered by date and filtered by tipster_id and Tipster =1:

Code:

SELECT `Deporte`, `Fecha`, `Rival1`, `Rival2`, `Cuota` FROM jos_tipster_pro WHERE `Tipster`='1'
SELECT `outcome` FROM jos_tipster_deltio WHERE `tipster_id`='1'



I have tried different ways and no success
Many Thanks
Tato
The administrator has disabled public write access.
 
#23452
Re:Pull data from two different tables into one 12 Years, 10 Months ago Karma: 760
Try the next SQL query:

Code:


SELECT 
  TD.outcome,
  TP.Deporte, 
  TP.Fecha, 
  TP.Rival1, 
  TP.Rival2, 
  TP.Cuota
FROM 
  jos_tipster_pro TP INNER JOIN jos_tipster_deltio TD
    ON TP.Tipster=TD.tipster_id
WHERE
  TP.Tipster = 1
ORDER BY 
  TP.Fecha DESC



Regards,
ARI Soft
The administrator has disabled public write access.
 
#23454
Re:Pull data from two different tables into one 12 Years, 10 Months ago Karma: 0
Amazing!! this works fine now, many thanks great support "On Sunday" as well, kind regards.

Tato
The administrator has disabled public write access.
 
Go to topPage: 1