Pull Data From 2 Database Tables Into 1 Table On My Site.
I got 2 tables: a dev_tasks and a task_history table. The task table has to record information about the task I am working on AND the history table is for the task history logs. I am trying to display info from both tables into 1 table on my site.
Most of the info will come from the dev_tasks table BUT i want to dedicate on column of the displayed info for the latest log made to the task_history table.
The common column to both tables is the 'taskid' column.
What would the query look like to pull the info from both tables, knowing that the taskid is common to both and that I want to display the last log per tasks from the task_history table?
View Complete Forum Thread with Replies
Related Forum Messages:
Pull Similar Data From Two Tables
I need a query to search two seperate tables for similar data and return them in one result. I know you can do multiple select statements in one query but I dont know how to exactly organize them into one result. Does anyone know how to accomplish this.
View Replies !
How To Pull Data From Multiple Tables
I have a db, with several tables in it, I have now reached to the point where I need to pull data from several tables. What is the best way to do this? Should I put a column in each table, and then insert a unique key in all of them at the time the record(row) is being created? If this is the way to do it, when I am putting the unique key in each table would I just do an insert in each of the tables?
View Replies !
Pull Data From Multiple Tables
Can you pull data from 2 tables in the same database onto the same page? What about more than 2 tables? Here is my dilema: I currently have a database with 1 table, and a ton of rows. The information is property information, and each property has multiple empty suites. As of now, I have columns for Building Name, Address, and then columns for Unit Type A (for the first unit), Rent A, Type B, Rent B, etc.... I was wondering if I would be able to put the listings we have into thier own property table, and then one bigger table of all the properties individual information. Keep in mind I need to call all tables together on my portfolio pages, so I would be connecting to quite a few tables at once. Or my other option I was thinking about was to just have 2 tables: 1 Buildings info, and 1 units info. Which of these would you do, or how would you organize this data.
View Replies !
Making Site Login Add Users To Phpbb Database Table
I have a login script for my site that I got off the net and was planning to use, but, I also wanted to make it so that when a user signed up thru the registration form it would also add them to the phpbb database's table. It wasn't discussed heavily from where i got the script but from what was mentioned the encryptions differ which results in a rejected login. Code:
View Replies !
Pull Info From One Database To Save In A Session To Push To A Different DB
I'm building a dynamic site that has 3 data bases. One DB contains all of my store info ID#, Name, Address, Phone. Another DB contains member info ID, Name, address, email,phone,etc... The 3rd DB Tracks when a user logs in and logs out at a store. This DB has the following columns Store ID, Member ID, log in time,log out time, time in store. The stores log in in the morning that starts a session-I need the session to pull the store's info ID#, Name,etc... so when a user logs in, in the store. The login page inserts the store ID, Store name, and user ID into the 3rd DB. There are a lot of stores how do I get the store variables to be inserted into the DB?
View Replies !
Pull The Last 10 Records From A Transactions From A Table
I'm trying to pull the last 10 records from a transactions from a table using this query: SELECT * FROM transactions ORDER BY timestamp DESC LIMIT 10 But I want to display the rows in ascending order by timestamp. I can't get the subquery below to work and not sure why: SELECT * FROM (SELECT * FROM transactions ORDER BY timestamp DESC LIMIT 10) ORDER BY timestamp ASC;
View Replies !
Extracting Data From Large SINGLE-table Database To MULT-table Relational Database
I have a very large single-table database of articles that I want to convert to a multi-table, relational database. The existing single-table database contains fields for article author, article source, and article category, where several 'author', 'source', and 'category' IDs repeat dozens of times for hundreds of different articles. I want to create seperate tables for author, source, and category and populate the new tables by extracting data from the original single-table database by unique ID field. I figured out how to use INSERT and SELECT to pull data in new tables, but can't figure out how to pull only a single instance of a unique author, source, and category to create master reference tables for author/source/category.
View Replies !
One Database For Site And Forum?
I have a site and a forum and I want to use one database for them, so when somebody registers in the site - to be registered automatically in the forum. Is this possible and if it is - how?
View Replies !
Database Design For Ecommerce Site
I am looking to design an ecommerce site with categorised products. Once built, I want my client to be able to add additional categories and be abel to add their products into their chosen category.Would I be best displaying this dynamnically after creating a table with the products category names in it or doing it static? Also, if I wanted to show a different header / meta tags for weach category how would I best tie this in?
View Replies !
Create Php Site From Existing Database
I have been contacted by one of my clients to construct a knowledge bank based on their ms access database. I have successfully converted the ms access database to MySQL using the GUI conversion tools supplied by MySQL.com . I am wondering, and I don't know whether this is the right site to do this, if I can easily create a php site based on the database tables that have been converted.
View Replies !
Linking Site To MySql Database
I have bought the PHP and Database book and have created a database [windows](saved under the default directory under Program FilesMySql...) and I have created a server. How do I link the website (localhost - same PC as one with MySQL) with the database or is it done automatically?
View Replies !
Building My First Database Driven Site.
Before I begin, can I just state I have never installed anything on Linux server, so I am very new to this... Okay at the mo I have and using MYSQL version 3.23.58 on my Linux Sever, incase this is important, heres the details of my server: WEB SERVEUR Platform : Small - Fedora Core 3 Control panel : Plesk 100 Config : AMEN 2400 - AMD Athlon XP 2400+ Disk: 80 Gb - Memory: 512 Mb OK, I need to upgrade to the latest MYSQL version. So far, I have downloaded "mysql-standard-5.0.24a-linux-i686.tar" and unpacked the file uner /usr/local This is where I am stuck, I have no idea what to do next.. I need help for someone never done this before, preferbally a guide like... STEP by STEP, type this,
View Replies !
Site User To A Paid Member? Database Design HELP
I am currently working on a website where there are 2 types of users. The regular site user and a paid member. I am trying to figure out the best way to design the database (mysql) without redundancy issues. The site user can eventually become a paid member but a member does not necessarily have to be a regular site user (in terms of category). Information stored on a site user - first name, last name, address etc. The userID being the primary key. The member pretty much the same thing but new info will be memberID, join date, expiry date, status (pending, active, expired). I thought the easiest way to do this was to have separate tables. Do you think the best way? My thoughts are: When the regular site user becomes a member then store the userID in the members table. The issue I am faced with is how to store the other pieces of information. The address is not mandatory for the site user but is mandatory for the member. So, if the site user has an address then store it in the member table? that's redundancy there. Then a member do not necessarily have to be a site user in the sense of storing the info in that table. Design issues to think about - activation of membership once a confirmed payment has been received - Client is using Paypal. -What if the user clicks on membership and the user is also a site user? -What if the user is logged in as a site user and clicks membership? I would greatly appreciate your design recommendations.
View Replies !
Copying Selected Data From Two Tables Into One Table
I have a list of members in my "members" table, and they can buy tickets for an event. When they buy them, their member id number and the ticket info is stored in the "transactions" table. For the final "tickets" table, which I want to print out to put on the door, I also need to have their email and name, which is in the "members" table but not the "transactions" table. What I want to do is insert bits of the "transactions" table into the "tickets" table, and then also use the member id number from the "transactions" table to lift out the corresponding member name and email address and insert them in as well. Here's what I tried before I realised that I probably need something quite a bit more complicated: INSERT INTO tickets (SELECT transaction_id, ticket_member_id, ticket_code FROM transactions), (SELECT name, email FROM members WHERE member_id=ticket_member_id) member_id is the one in the "members" table. Basically, here's what I want the "tickets" table to look like (the columns): transaction_id (from "transactions") ticket_member_id (from "transactions") ticket_code (from "transactions") name (from "members" using ticket_member_id) email (from "members" using ticket_member_id) I think I need to use a while to iterate through everything but just thought I'd check in case there's an easy way.
View Replies !
Select Data From 2 Tables (join) REGARDLESS Of One Table Not Containing A Row
SQL SELECT o.title, o.quantity, o.price, o.product, i.supplierFROM store_order_inv o, store_inventory iWHERE o.product = i.productAND o.cart_order_id = ?-195509-3867' my only problem is if a row with Product ID doesnt exist in inventory, no result is returned, EVEN if a row exists in order_inve table with that product. So my question is, is it possible to select data from 2 tables, but where the presence of a row with matching PRODUCT field in the inventory table is OPTIONAL
View Replies !
Data Insertion/Update Form Different Tables Into On Table
I have 3 tables say Employees, Benefits, Employee_Benefit_Mapping. These tables are something like this: Employee: ======== Employee_Id Name Dept_Id . . Benefits: ========= Benefit_Id Benefit Name . . Employee_Benefit_Mapping: ========================= Mapping_Id Employee_Id Benefit_Id Its a many to many relation. Hence the mapping table. Now the situation and question is: ==================================== Every employee "In a certain Dept" is eligible for some benefits by default. How can add these records with one (or minimum) insert statement(s) rather than going employee by employee? Insert into Employee_Benefit_Mapping ((Select Employee_Id from Employee where Dept_Id = xx), (Select Benefits_Id from Benefits where Benefit_Id in(xx, yy))) Will this work to insert all the data into the mapping table?
View Replies !
Multiple Tables Of Data, Single Category Table
I've searched and can't find what I'm after, so apologies if this has been covered before. I'm working on a small and simple CMS for a site I'm doing, and just as I was going to start the database I realised something... (I'm using PHP and MySQL) When it's finished, there will be articles, weblogs and content/features. Previously I've done a seperate categories table for each table I have, for example articles and articles_cats. Then a field in the articles table for the category. Now I'd like to use the same categories table for everything on the site. However, I'd really like to have a link table, so each article can have multiple categories. Would I have a table to link articles and cats, then a table to link weblog posts and cats?
View Replies !
Determining Which Table To Query Based On Data Within Tables
I have 2 tables: default_categories column 1: category_id column 2: category_name column 3: category_parent custom_categories column 1: custom_cat_id column 2: custom_cat_name column 3: custom_cat_parent The custom_categories table won't necessarily have anything in it but if it does, I need to choose the data from the custom_categories table over the data from the default_categories table. So if the default category has 3 rows with IDs | names: 123 | Dogs 456 | Cats 789 | Fish And the custom category has 1 row with IDs | names: 456 | Very Cute Cats I want my query of these 2 tables to produce the following IDs | names: 123 | Dogs 456 | Very Cute Cats 789 | Fish I've tried joins like the one below but they aren't working because if there is no custom_cat_id, it won't give me the result for the default category_id. MySQL SELECT * FROM default_categories LEFT JOIN custom_categories ON category_id = custom_cat_id WHERE category_parent = '' AND custom_cat_parent = '' ORDER BY $order_by $sort
View Replies !
Many Databases With 1 Table Or 1 Database With Many Tables
I've to manage many 'table' (having same scheme) on the same server. And I ask myself what could be the best to do (and if you know, why) : Creating as many database (the name would be a 8byte int value (converted to a string)) as necessary, all with the same table struct (and table name), or create 1 database and in it create also as many table as necessary (so also a 8byte int value as name) ? Has mysql some limitations on that (database/table) and what about the performance issue ?
View Replies !
Pull All Records
if it were possible to write a statement in SQL where one could select several fields from a table and then limit the records returned by only displaying those where, say, FieldA (a varchar) contains a given short string which could be only a part of the field's contents. As long as a record has this short string in Field A, it should be included in the resulting set of records.Something like this: SELECT FieldA, FieldB, FieldC FROM TABLE Table1 WHERE FieldA *contains string* Is there anything in SQL that could examine the contents of a field for a partial string, and then return the records that have that partial string in that field?
View Replies !
Multiple DB Pull
Lets say there is a database of special users and a database of favorite movies SPECIAL USERS (username) bob jim FAVORITES (username - movie_title) bob - movie 1 kim - movie 3 jim - movie 1 larry - movie 2 jane - movie 2 How would I write a query that lists the most popular movies of special users without explicitly doing: SELECT * FROM FAVORITES WHERE username = 'bob' or username = 'jim' GROUP BY movie_title I want something like this: SELECT * FROM FAVORITES WHERE username = [all the usernames from the SPECIAL USERS DB] GROUP BY movie_title
View Replies !
Mysql Pull
I got this in my mysql databe table. a:1:{i:0;O:19:"test_Enclosure":4:{s:4:"link";s:36:"http://grabber/v/CAcpLiw4qt4.swf";s:4:"type";s:29:"application/x-shockwave-flash";s:6:"length";N;s:10:"javascript";s:2:"js";}} I want to pull out only the http://grabber/v/CAcpLiw4qt4.swf part?
View Replies !
Can Input Japanese, Can't Pull It Out
I figured out how to store Japanese characters by setting the collation of a particular field to utf8_bin. I can input Japanese characters, and I can see them just fine under PHPMyAdmin. The problem is that when I execute a query and print them to a web page, all I get is question marks instead of Japanese characters. This is while using the same browser that allows PHPmyAdmin to display the characters correctly. I added the following metadata to the <head> portion of the document but it didn't help: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
View Replies !
Populate A Pull Down Menu From Db
how do I populate a pull down menu from a MySQL table? Using PHP/MySQL 4.0 Have table1 with names and ID and tableb with ID and statistical info.wnt to be able to scroll names and have users able to click on the name to follow a link to a page created using tableb data for each name listed. Table examples: tablea ID l Name --------------------- 1 Person, Joe 2 Smith, Joe tableb ID l units l margin -------------------------------- 1 5023 123 2 2536 72
View Replies !
Code To Pull Amount
I'm certain there is a function to do this but I forget what it is... Say I am pulling values from the database, but I only want to pull like the first 10 chars of the value.. how do I do that?
View Replies !
Pull Hosting Plans
I am currently creating a web hosting website for a client of mine, for the packages and the order process we are using a script called "Auto-Host (http://www.idevspot.com/AutoHost.php)", which stores all the hosting plans into a mysql database. This is a great script and it does exactly what we want it too, the only thing missing is it doesnt create a page where people can view the hosting plans and click a sign-up button. Can someone please give me guidance on how i can get a page with all the hosting plans on please?, alternatively i am willing to pay somebody for doing this on my behalf
View Replies !
Database Design Set Up Question-Many Tables Vs 1 Table Design
I have set up a construction business on the web and recently switched to MYSQL from Access. Question I have is I have four basic project tables (Specs, Materials, Labor, Tasks) that have about 2200 items in each that get uploaded into 4 master tables with the projectid and clientid's I am wondering if it would be better database design to make separate tables for each project (4 tables for each project) instead of having an ever increasing 1 large table for each category holding all project info? I could number the tables with the projectid ( 1091_materials, 1091_specs, etc ) Uploading these files has been having problems.
View Replies !
Pull Related Info Using Subqueries
I'm creating a tool to browse a database of movie listings. The browser pulls up 25 results at a time, and you can page through them using 'Next' and 'Prev' tools. Pretty basic stuff. Here are my tables: movies directors comments movies_directors movies_comments etc... (primary key is movies.id) But here's where I'm stuck: for each film, I need to pull the movie info in 'movies', plus any related data from other tables, like this: The Lord of the Rings | Peter Jackson | 3 comments Episode II | George Lucas | 0 comments Indiana Jones | Steven Spielberg | 15 comments I seem to run into problems when I try to join info from all of these related tables. If there's a match, great. But, if not (like a movie with no comments), the movie is excluded from the result set. I've tried all sorts of SQL queries to make this work, but nothing seems to do the trick. SO, HERE'S MY QUESTION, IS THERE ANY WAY TO DO THIS QUERY WITHOUT SUBQUERIES/MYSQL 4.0? Or would the best approach be to use PHP to do all the subquery lookups?
View Replies !
Result Pull And Rating Sort
I have two databases. What I would like to happen is when I have a summary of products, I would like the query to pull the info from the product table and based on the id from that table cross reference with the reviews for that particular product and calculates all the reviews for that product into a single percentage. So when I access the assoc array from PHP I would like to see : Array(Array(['id'] => '2', ['prod_name'] => 'gummy bears', ['rating'] => '72'), Array(['id'] => '57', ['prod_name'] => 'socks', ['rating'] => '52')).
View Replies !
Regular Expression :: Pull 3 Or 4 Digit Numbers
I would like to pull all the model number from my products table that are strictly only a 3 or 4 digit number ie: 034 or 3542 or 0243 or 934 etc Can someone advise me on how to construct a regular expression to give me the data I need?I have tried the following but it wasnt 100% accurate: Code: products_model REGEXP "[[:<:]][0-9][0-9][0-9][0-9][[:>:]]" or products_model REGEXP "[[:<:]][0-9][0-9][0-9][[:>:]]"
View Replies !
Trying To Pull Id, Count And Title But Lose Rows When I Add Extra Join
i'm trying to extract some information from my database, the query being PHP SELECT grps_c.catid, grps_c.title, COUNT(grps.groupid) AS COUNT FROM grps RIGHT JOIN grps_category grps_c ON (grps_c.catid = grps.catid) GROUP BY grps_c.catid ORDER BY grps_c.title which works fine. however some of the groups (grps.groupid) are hidden and i don't want to count them, so my thinking was add PHP LEFT JOIN grps_setting grps_s ON (grps_s.groupid = grps.groupid AND grps_s.hidden_group != Ƈ') however adding that removes the rows that have a 'count' or NULL or Zero.
View Replies !
InnoDB Tables And MyISAM Tables In ONE Database?
My application demands some advantages from InnoDB and some from MyISAM. Is it attainable to have both InnoDB tables and MyISAM tables in ONE database? Or else, getting views from two databases, one from InnoDB and the other from MyISAM? If not possible, any other approaches will do the job?
View Replies !
How To Apply New Database Structure To An Existing Database, Without Overwriting Data?
I am writing a simple blog software application. We released a version of this software a while ago. It comes with a sql-tables.sql file, that you can just import into your mysql database and it will setup all the tables for you, for a fresh installation. We made the sql file by just doing an export I believe, without exporting the data that was in OUR database. Well, since then several people have downloaded and installed our software, and are using it. We are about to release a new version soon, however. Since it is all still under development, many things have changed in our database structure. We've added new tables, and modified or even removed fields from existing tables. So for the new release, we're going to include a new sql-tables.sql file obviously, so that for fresh installations they can still install it just like normal. However, the question is... how do you "upgrade" all the previous version's users's databases, without losing any of their data? Is there anyway to export just the structure of our current database... then somehow apply it so that it just goes through and changes another database to match the new structure? Or any ideas at all how to do this?
View Replies !
Site Down
Need help figuring out ohow to unlock tables. Everytime I try a repair with my Web Host Manager my whole site freezes up. I have one table that is "in use" a sessions table. I can use putty and get to the >Mysql prompt but I am lost from there... Is there a way to repair or fix this? I have tried using phpmyadmin and cpanel and neither work, they just time out.... what command should I use?
View Replies !
MySQL On A Web Site
I am working on a web page that is currently using a MySQL database to manage our product inventory on our web site.The problem is that I am not the person who developed the web page, but it is now my responsibility. I am going to continue using the existing database, but the management process of a MySQL database on a web server is a new process for me.I am going to assume that I should be using the phpMyAdmin tools to interface with the database, but the php programming is new to me, as well. I'm a fast learner, so what I'm really looking for is a bit of direction in how I can improve or reconfigure the output for the end-user.Anyway, I don't know if I have provided enough information, but if any of you guys can point or steer me in the direction that would make me an educated contributor to these forums, I would appreciate the introductory patience.
View Replies !
Connect My Site
Im trying to connect my webpages to the MySql database that i have as part of my hosting account, ive dropped a MySqldump file into the database and have been trying to connect my site to the database but im somewhat confused about how to do this, i understand ive got to use a little bit of code to make the connection but where do i place that code? and do i place it on every webpage, im trying to put together GET variables so that when someone clicks the "Buy" link it should then make the billing popup appear, but mainly at the moment my main confusion is about actually what to insert and where, in order to make the connection between my pages and the database
View Replies !
|