faqts : Computers : Databases : MySQL : Utility : PHPRunner

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 1 people (0%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

PHPRunner: SQL query: Can you use a 'WHERE' in your SQL query? [SELECT / INNER JOIN / MySql]

May 21st, 2005 11:25
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 20 May 2005 - 00:16 am ------------------------

PHPRunner: SQL query: Can you use a 'WHERE' in your SQL query? 
[SELECT / INNER JOIN / MySql]

---

PHPRunner v2.0 beta

---

No, that is not possible in the current latest version

---

e.g.

--- cut here: begin --------------------------------------------------

SELECT
 column1,
 column2
FROM
 table1,
 table2
WHERE
 table1.primaryKey = table2.foreignKey
;

--- cut here: end ----------------------------------------------------

is not possible to use,
because the syntax contains this word 'WHERE'.

---

So you should rewrite you query, using the
'INNER JOIN' keyword.

---

e.g.

--- cut here: begin --------------------------------------------------

SELECT
 column1,
 column2
FROM
 table1
INNER JOIN
 table2
ON
 table1.primaryKey = table2.foreignKey
;

--- cut here: end ----------------------------------------------------

---

e.g.

--- cut here: begin --------------------------------------------------

SELECT
 table1.fieldname1,
 table1.fieldname2,
 ...
 table1.fieldnameLast
 table2.fieldname1,
 table2.fieldname2,
 ...
 table2.fieldnameLast
FROM
 table1
INNER JOIN
 table2
ON
 table1.primarykey = table2.foreignkey

--- cut here: end ----------------------------------------------------

---

e.g.

--- cut here: begin --------------------------------------------------

SELECT
 `table1`.`primaryKey`,
 `table1`.`column1`,
 `table1`.`column2`,
 `table2`.`column3`
FROM
 `table1`
INNER JOIN
 `table2`
ON
 `table1`.`primaryKey` = `table2`.`foreignKey`
;

--- cut here: end ----------------------------------------------------

---

e.g.

--- cut here: begin --------------------------------------------------

SELECT
 table1.primaryKey,
 table1.column1,
 table1.column2,
 table2.column3
FROM
 table1
INNER JOIN
 table2
ON
 table1.primaryKey = table2.foreignKey
;

--- cut here: end ----------------------------------------------------

---
---

Internet: see also:

---

SQL join
http://www.w3schools.com/sql/sql_join.asp

---

Database: MySql: PHPRunner: Link: Can you give an overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/35950/fid/1805

----------------------------------------------------------------------