Jump to content

SQL syntax


Recommended Posts

schema

[b]owner[/b]{
pk ono
fname
lname
adress
}

[b]property_for_rent[/b]{
pk pno
fk ono
adress
}

hi guys here are some tables, the owners own more than one property each

SELECT fname&" "&lname&", "&address AS [owner], pno
FROM property_for_rent p, owner o
WHERE p.ono = o.ono

the prob is i get seperated records for each property owned by a single guy, i need to show his or her details once and then followed by the pno (property number)'s they hav.

let me giv u a visual of what i am getting with the above code

owner 1 pno
owner 1 pno
owner 1 pno
owner 2 pno
owner 3 pno
owner 3 pno
owner 3 pno

let me giv u a visual of what i whant

[b]owner 1[/b] pno
pno
pno
[b]owner 2[/b] pno
[b]owner 3[/b] pno
pno
pno

i know you can count things this way using GROUP BY and COUNT(*) so u must be able to show them this way.

thanks alot for any help.
Link to comment
https://forums.phpfreaks.com/topic/9916-sql-syntax/
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.