Reply to Anoying SQL problem

Your name:

Reply:


Posted by b on 09/28/81 11:55

I have a problem with the below SQL I want to return hirers and their
related details for accounts they have.
But in my several WHERE clauses that I use, I check fields in the
arrangements table, sooo, if a client
Has many Arrangement set for their account, it returns that clients
details x amount of times based on how many arrangements records
relate to there account. So my problem is, I need to be able to query
the arrangements table for a client's account but not return duplicate
results for every arrangement relating to that account. So it ignores
the arrangements table with regards to the amount of records entered
for a account and just queries it if records exists, but doesn’t
return duplicate hirers for the amount of arrangements for that hirers
account.

THANK You so much!!!


SELECT Hirer.Hirer_ID, Hirer.Hirer_First_Name, Hirer.Hirer_Surname,
Hirer.Hirer_Address, Hirer.Hirer_DOB,
Accounts.Account_number, Account_Type.Account_Type,
account_status.Account_Status, Clients.Client_Name,
Agents.Agents_Name, Vehicle.Vehicle_Registration
From hirer
left outer join Accounts on (hirer.hirer_ID =
Accounts.hirer_ID)
left outer join account_status on (Accounts.account_status_ID =
account_status.account_status_ID)
left outer join Account_Type on (Accounts.Account_Type_ID =
Account_Type.Account_Type_ID)
left outer join Vehicle on (Accounts.Account_ID =
Vehicle.Account_ID)
left outer join Clients on (Accounts.Client_ID =
Clients.Client_ID)
left outer join Agents on (Accounts.Agents_id =
Agents.Agents_id)
left outer join Arrangement on (Accounts.Account_ID =
Arrangement.Account_ID)
Where <condition removed>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация