Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa SQL select result from three tables using sql.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Arjun Sasi
select result from three tables using sql.
1 Answer(s)      a year and 8 months ago
Posted in : SQL


I want to get a result from three tables. i dont how to write the sql query. Please help me.
"I want to display Name,Username and Product_Name where Id=007"

table "register"

Name  Username  Id
Arj   arjun     007
xyz   abcd      008
abcd  asdf      007

table "products"

Product_Id   Product_Name   Price
101           Clothes        200
102           Games          100

table "purchase"     //products.Product_Id=purchase.Item

Username   item    Id
arjun      102     007
abcd       101     008
asdf       102     007

I am not sure, is it possible. but help me. THANKS IN ADVANCE


Advertisement
View Answers

February 6, 2013 at 6:10 PM


hi friend,

Use the following SQL query may this will helpful for you

SELECT r.Name,r.Username, p.Product_Name FROM register r, products p,purchase pr
WHERE r.id=7 AND r.Username = pr.Username AND p.ProductId = pr.ProductId



Related Tutorials/Questions & Answers:
select result from three tables using sql.
select result from three tables using sql.  I want to get a result from three tables. i dont how to write the sql query. Please help me. "I want to display Name,Username and Product_Name where Id=007" table "register" Name
mysql select from multiple tables
mysql select from multiple tables   how can i select the date field from multiple tables in mysql?   "UNION" can be used to select data from multiple tables in my sql... for example (SELECT * from name where `name
Advertisements
merge tables in sql using union
merge tables in sql using union  How to create a new table in database by merging two tables using union function in SQL?   REATE TABLE new_table SELECT * FROM table1 UNION SELECT * FROM table2;   
create the SQL tables from an XML schema
create the SQL tables from an XML schema  I'm using Eclipse, Please let me know if anyone developped an application that would automatically create the SQL tables from an XML schema
SQL Select From
SQL Select From       SQL Select From keyword show you the records from a specified table. Understand with Example The Tutorial illustrate an example from 'SQL Select From
Data fetch from multiple SQL tables - Hibernate
access code into Hibernate code. The tables in SQL are not related using foreign...Data fetch from multiple SQL tables   I am in the process of writing my first hibernate application. I have a sql query that fetches data from
SQL Server row comparison using two tables
SQL Server row comparison using two tables  insertion process are completed in table1.string comparison using table2 to table1 if any changes in these tables and then upadated
sql query to get data from two tables
sql query to get data from two tables  how can i get the data from two different tables?   Hi Friend, Please visit the following link: JOIN Query Simple Query Thanks
sql query to get name,age,phone,address from tables t1,t2,t3,t4,t5 ..
sql query to get name,age,phone,address from tables t1,t2,t3,t4,t5 ..  ... , address FROM t1 order by name"; this is for 2 tables : query ="SELECT t.name... by name"; i want for 12 tables : i want to fetch name age pwd phone address from 12
Joins tables in jsp
;    When we want to select data from two or more tables to make our result complete. We have to perform a join between tables... are two tables and result will be from both tables on the basis of 'ID' which
select Query result display problem
select Query result display problem  Hi, String SQL_QUERY ="from Cc"; Query query = session.createQuery(SQL_QUERY); for(Iterator it=query.iterate... Hibernate: select cc0.id as col00 from cc cc0_ Cc$$EnhancerByCGLIB$$2235676a cannot
Join the two tables in sql
Join the two tables in sql  How to join the two tables in SQL ..and return the value from common column in SQL Database
how to forward select query result to jsp page using struts action class
how to forward select query result to jsp page using struts action class  how to forward select query result to jsp page using struts action class
I need to join three tables and return data that may not be in all three tables
I need to join three tables and return data that may not be in all three tables  How do I join three tables and return information even... is I need information to be returned even if it is not in all three tables
PHP SQL Result
PHP SQL Result      ... returned  from the sql query execution, we have created sql_result.php page. First, connection from database is created using mysql_connect("hostName"
SQL All Tables
SQL All Tables       SQL All Tables is used to show all the tables in database. Understand with Example The Tutorial illustrate an example from 'SQL All Tables'. To understand
Joining tables using criteria
Joining tables using criteria  How do i join more than three tables and retrieve one column from parent table and count of unique values in a single column from child table,the joined tables must be maintain primary key
PL/SQL tables
PL/SQL tables   hii, Describe the use of PL/SQL tables ?   hello, PL/SQL tables are scalar arrays that can be referenced by a binary integer. They can be used to hold values for use in later queries or calculations
how to get values for same column name from two different tables in SQL
how to get values for same column name from two different tables in SQL  how to get values for same column name from two different tables in SQL???? column name is emp_id loacated in these two tables company,employee
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ... = stmt.executeQuery("select B.book_id,B.name,B.phoneno from booking_table B... = con1.createStatement(); ResultSet rs1 = stmt.executeQuery("select seat_id from booked
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ... = stmt.executeQuery("select B.book_id,B.name,B.phoneno from booking_table B... = con1.createStatement(); ResultSet rs1 = stmt.executeQuery("select seat_id from booked
how to retrieve data from multiple tables in jsp using javabeans
how to retrieve data from multiple tables in jsp using javabeans   ... = stmt.executeQuery("select B.book_id,B.name,B.phoneno from booking_table B... = con1.createStatement(); ResultSet rs1 = stmt.executeQuery("select seat_id from booked
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database. ... but was unable to find out exact way to fullfill the solution of selecting value from autocomplete textbox using jquery in jsp from mysql database. Kindly send me
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database.  Hii Sir, Lots of thnx to ur reply .I went through both... of selecting value from autocomplete textbox using jquery in jsp from mysql database
Using criteria for multiple tables
Using criteria for multiple tables  How to join more than three tables,those tables must be maintain primary key relation ship using Hql criteria & projections
Using criteria for multiple tables
Using criteria for multiple tables  How to join more than three tables,those tables must be maintain primary key relation ship using Hql criteria & projections
SQL Union
Union is used to return the result of select queries from two table 'stu.... SELECT * FROM stu UNION SELECT * FROM stu1; Result...; SQL Union is used to combine the query of two or more Select Statement
Select today's date sql
Select today's date sql   I wanted to show the data from database according to the current date. So, can anyone give me the select today's date sql query? Thanks!   select current date in mysql query select * from
PHP SQL Select Where
PHP SQL Select Where       PHP SQL Select Where is used to provide the records from the table... from 'PHP SQL Select Where'. To understand and grasp the example we create
Describe the use of PL/SQL tables
Describe the use of PL/SQL tables  Describe the use of PL/SQL tables   Hi, PL/SQL tables are scalar arrays that can be referenced by a binary integer. They can be used to hold values for use in later queries
SQL SELECT DISTINCT Statement
The Tutorial illustrates you an example from SQL Select Distinct... SELECT DISTINCT columnName(s) FROM tableName SQL SELECT DISTINCT... SQL SELECT DISTINCT Statement     
 

 

 

DMCA.com