Welcome, Guest
Please Login or Register.    Lost Password?

Pulling from Multiple tables in a database
(1 viewing) (1) Guest
This is the optional Forum header for the Suggestion Box.
Go to bottom
Post Reply
Post New Topic
Page: 123
TOPIC: Pulling from Multiple tables in a database
#646
Pulling from Multiple tables in a database 1 Year, 6 Months ago Karma: 0
Hi All, I would like to know how retrieve data from multiple tables into one grid for display ????

I Need to get data from the following tables eg. jos_mailinglist_user and jos_mailinglist_cfields - i need data from both these jos tables to display in just one grid.

Thanks

Much appreciated
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
zunaidfloris
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#651
Re:Pulling from Multiple tables in a database 1 Year, 6 Months ago Karma: 1
Hi,

you can create SQL view (using e.g. phpMyAdmin), join two or more tables and display view with Table JX.

Best regards,
Viljem
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
viljem
Admin
Posts: 181
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#675
Re:Pulling from Multiple tables in a database 1 Year, 6 Months ago Karma: 0
How can this be done... please an example
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
shinigami
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#679
Re:Pulling from Multiple tables in a database 1 Year, 6 Months ago Karma: 1
Hi,

example below that will join two tables and create DB view:
(using phpMyAdmin, running SQL script)

Code:

CREATE VIEW Something AS
SELECT t1.Name, t2.TelephoneNumber
FROM Table1 t1, Table2 t2
WHERE t1.ID = t2.ID



*You have several possibilities how to join tables (left join, right join, full join, inner join )

Best regards,
Viljem
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
viljem
Admin
Posts: 181
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#716
Re:Pulling from Multiple tables in a database 1 Year, 5 Months ago Karma: 0
Hi

A new user, can't find how to create a post so adding my question to this. You have a nice product! I need some guidance as to the best way to do this (see below). I am an experienced SQL and db guy so can create view etc - the issue I have is I need dynamic sql in the manner of

select from foo where name like 'FRED%' where FRED is what the user keyed in the search or other box. As it is now the user can put FRED in the search box or just a wildcard (%) and get ALL the rows of the database.
Ideally I'd like to be able to change the where clause that populated the table dynamically.

I'm thinking if I had another textbox someplace and the user entered FRED into it (for example) I could update a table called prefix_USERVAL with username and FRED (in this case) and then change the query to match on username and look at this new table to figure out the search extent BEFORE the grid os populated.

Is any of this making sense?

Thanks

Chris
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
chrise99
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#718
Re:Pulling from Multiple tables in a database 1 Year, 5 Months ago Karma: 5
Hi,

I'm no sure that I understood you exactly. But, there is an option to display data according to the user if this is what you need. For taking advantage of this option, you have to have a column in your table that consists of user IDs. Than go to the backend, scroll down to the advanced section and simply write WHERE mycolumn_of_user_ids = @user_id.

I hope this was helpful.

Regards,
Tomaž
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
tomaz
Moderator
Posts: 282
graph
User Offline Click here to see the profile of this user
Reply Quote
 
Go to top
Post Reply
Post New Topic
Page: 123
Moderators: tomaz
Tools JX, Powered by Joomla!; Joomla templates by SG web hosting