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
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.