Jump to content


Photo

SQL syntax


  • Please log in to reply
1 reply to this topic

#1 nadeemshafi9

nadeemshafi9
  • Members
  • PipPipPip
  • Advanced Member
  • 1,245 posts
  • LocationUK

Posted 18 May 2006 - 12:09 PM

schema

owner{
pk ono
fname
lname
adress
}

property_for_rent{
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

owner 1 pno
pno
pno
owner 2 pno
owner 3 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.
DONT LAY AN EGG OVER IT

#2 nadeemshafi9

nadeemshafi9
  • Members
  • PipPipPip
  • Advanced Member
  • 1,245 posts
  • LocationUK

Posted 05 June 2006 - 05:02 AM

ignore wot i said up there i didnt know what i was talking about then, i do now, sorry, thanx anyway.
DONT LAY AN EGG OVER IT




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users