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



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

Have Programming Question? Ask it here!
 
 
 


Arjun Sasi
select result from three tables using sql.
1 Answer(s)      a year and 2 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
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
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
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"
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
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
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
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
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
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
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
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
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     
Select Statement in SQL, SQL Tutorial
The SELECT statement for SQL       SELECT key word is used to select data from a table.  Syntax...) FROM table_name   Example: To select
i want to select a multiple value of check box by using onclick or onchange event without using from submission
i want to select a multiple value of check box by using onclick or onchange event without using from submission   i have 4 check box name 1)profile... the result is ok but after getting value of first box now i want a result of second box
Select from select list + display
Select from select list + display  i have a select list containing... select EmpCode from the select list, the corresponding EmpName and DeptName should...=con.createStatement(); ResultSet rs=st.executeQuery("select * from emp
mysql select statement - SQL
mysql select statement  i want to select id,name,age values from database.i created the following coding to select values from the table according to the id value which is selected by the user.pls help me select id,name,age from
Finding MAX value from emp_id column using SQL query?
Finding MAX value from emp_id column using SQL query?  I need to select maximum of the Emp_id values from SQL server 2005 table.I was using... of emp id from the table.(Actually it picks up Max value using by looking at 1st
how I do select from select in hql
how I do select from select in hql  select RN from ( select rownum RN, dbid from ( select * from profile p where type = 1912 and name like... doesn't work select RN from ( select rownum RN, DBId from ( select distinct p
Retrieve data from database by using sql tag of JSTL SQL library
Retrieve data from database by using sql tag of JSTL SQL library... we will see how retrieve data from database using sql query given by user... used a sql tag <sql:query>, it executes sql and stores result
SQL get start date and end date result
SQL get start date and end date result  how to get ( 15 march 2011) and (15/03/2011) output using SQL
Purge Data from Mysql tables
to purge data from tables. but written procedure clear entire tables data...; DELETE FROM conference_table WHERE confrefno= confRefNo; SELECT COUNT(listid... FROM listid_table WHERE listid=listID; END IF; SELECT COUNT
php MySQL order by clause
; In SQL generally we use three clauses, select ,from, and where. ...); $result=mysql_query("select * from student order by name asc"); while... of SQL is as follows: select <list of fields to be displayed
Select data from diplicated data
location FROM (".$is.") WHERE sub_cat=('".$id."')"; $result = mysql_query($SQL...++) { $SQL = "SELECT duration FROM core_network WHERE location=('".$location_c[$k...Select data from diplicated data  hello i have table location
How to insert image in sql database from user using servlet
How to insert image in sql database from user using servlet  pls tell me accept image from user and insert image in sql server 2005 database using servlet and jsp
Using JOINING Operation in JDBC
; Whenever we need to select data from two or more tables, we have to perform... and testing, to use JOIN. The SQL JOIN clause is used to retrieve data from two... from one table matches a foreign key in another table. Consider the SQL JOIN
how to export the query result in SQL Server to .csv file?
how to export the query result in SQL Server to .csv file?  how to write table data into CSV file using SQL SERVER 2008
select query using hibernate
select query using hibernate  Hi, can any one tell me to select records from table using hibernate. Thanks   Please visit the following link: Hibernate Tutorials The above link will provide you different
retrive article from sql databse and show using php
retrive article from sql databse and show using php  hello sir i have sql database which i store articles.i want to show these article on web page using php. my field are image,title,summary,content id. plz provide me
PHP SQL Select
PHP SQL Select       PHP SQL Select is used to execute mysql select query in the php application. The PHP SQL Select uses mysql_select_db () function that set the active MySQL
Php Sql Result
Php Sql Result This example illustrates how to display result on the browser and how to use the result in the php application. In this example we create a select query by using mysql_query method and stored it in the result variable
Dropdown code to retrieve result from oracle database
Dropdown code to retrieve result from oracle database  Hi Friends, I... retrieve the result from Oracle database.We have procedures created already.Just need to fetch the result when the dropdown is chosen.Can anyone please help me
Advertisements
 

 

 

DMCA.com