Welcome Guest, Not a member yet? Register   Sign In
Small Question
#11

[eluser]robertGM[/eluser]
Anyone ?
#12

[eluser]scornaky[/eluser]
TABELA Clienti
ID
....
{other column(s)}
TABELA program_saptamanal
firma
agent_id
....
{other column(s)}
Conditions:
a) Saptamana viitoare . firma !=''
b) Saptamana viitoare . agent_id = $user->id
c) SORT BY Clienti.username ASC

Code:
$sql="SELECT * FROM clienti as A
INNER JOIN program_saptamanal AS B
ON A.id = B.firma

WHERE
B.firma!='' AND
B.agent_id='{$user->id}'
ORDER BY A.username ASC";

Take a look at condition(s) in query. (As I know) If you use inner join will perform records that match in both table and is not necessary to select "distinct" - make no sense.

take a look here for visual SQL
http://www.codeproject.com/KB/database/V...S_orig.jpg




Theme © iAndrew 2016 - Forum software by © MyBB