Jul 20, 2008

Sql Selection Issues

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Sql Selection Issues

magiccode9
CODE
CREATE TABLE pbm_album (
    id TINYINT(8) AUTO_INCREMENT,
    parent_id TINYINT(8)
    pbm_name VARCHAR(100),
    pbm_desc VARCHAR(150),
    pbm_order TINYINT(8),
    pbm_image varchar(100),
    pbm_cat_id TINYINT(8),
    pbm_create_date int NOT NULL,
    FOREIGN KEY pbm_cat_id REFERENCES pbm_catalog(id),
    PRIMARY KEY(id)
)

CREATE TABLE pbm_photo (
    id TINYINT(8) AUTO_INCREMENT,
    pbm_name varchar(20) NOT NULL,
    pbm_title varchar(60) NULL,
    pbm_album_id TINYINT(8) NOT NULL,
    pbm_create_date int NOT NULL,
    FOREIGN KEY pbm_album_id REFERENCES pbm_album(id),
    PRIMARY KEY(id)
)


hi I got a issue when selecting some data.
What I'am doing is to select all albums and photos that presents in the current album. However, for now I just can select all albums under the current album.

This is the statement I do obtain albums
CODE
SELECT a.id, a.pbm_name, a.pbm_desc, a.create_date, count(p.pbm_album_id)
   FROM pbm_album a
     LEFT JOIN pbm_photo p ON
        a.pbm_parent_id = p.pbm_album_id AND p.pbm_album=[album_id]
           GROUP BY a.pbm_name
                ORDER BY a.create_date


It provides me all info about album, but when a album that both hold albums and photos.
How do I select both of it as the tables structure are different between the two.


[ref]
[ Album Name ] - [ Some Photos ] [ Album Name ] - [ Album Name ]

Thanks
Eric,

 

 

 


Reply

derickkoo
QUOTE(magiccode9 @ Nov 2 2006, 01:05 PM) *

CODE
CREATE TABLE pbm_album (
    id TINYINT(8) AUTO_INCREMENT,
    parent_id TINYINT(8)
    pbm_name VARCHAR(100),
    pbm_desc VARCHAR(150),
    pbm_order TINYINT(8),
    pbm_image varchar(100),
    pbm_cat_id TINYINT(8),
    pbm_create_date int NOT NULL,
    FOREIGN KEY pbm_cat_id REFERENCES pbm_catalog(id),
    PRIMARY KEY(id)
)

CREATE TABLE pbm_photo (
    id TINYINT(8) AUTO_INCREMENT,
    pbm_name varchar(20) NOT NULL,
    pbm_title varchar(60) NULL,
    pbm_album_id TINYINT(8) NOT NULL,
    pbm_create_date int NOT NULL,
    FOREIGN KEY pbm_album_id REFERENCES pbm_album(id),
    PRIMARY KEY(id)
)


hi I got a issue when selecting some data.
What I'am doing is to select all albums and photos that presents in the current album. However, for now I just can select all albums under the current album.

This is the statement I do obtain albums
CODE
SELECT a.id, a.pbm_name, a.pbm_desc, a.create_date, count(p.pbm_album_id)
   FROM pbm_album a
     LEFT JOIN pbm_photo p ON
        a.pbm_parent_id = p.pbm_album_id AND p.pbm_album=[album_id]
           GROUP BY a.pbm_name
                ORDER BY a.create_date


It provides me all info about album, but when a album that both hold albums and photos.
How do I select both of it as the tables structure are different between the two.
[ref]
[ Album Name ] - [ Some Photos ] [ Album Name ] - [ Album Name ]

Thanks
Eric,



Hey, does a column "pbm_album" in the table "pbm_photo" ???

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : sql, selection, issues

  1. Installing And Running Glype Proxy
    (2)
  2. Issues Uploading A File [resolved]
    (3)
    Hi there. I have been trying to upload a zip file only about 2mb to my account through CPanel.
    First I tried uploading it to a new folder in public_ftp. Then i tried to put it in the main part
    of public_ftp. I also tried the same thing in public_html. It shows the file being uploaded, and i
    get 100 %, but alas, when i look in the folders nothing is there. Is there a restriction on .zip
    files? I have had no problems as of yet uploading htm and html pages. Please let me know ASAP.
    Thank you.....
  3. Issues With Router Freezing
    (3)
    I am curious as to if anyone else here experiences random freezing with their routers. It seems to
    happen to me most when using my D-Link, and I end up having to unplug it and replug it back in every
    hour or so. The same thing happens at my neighbor's house and we have the same type of router. I
    don't know the model number off the top of my head but I can go check if it is needed. As for
    the issue, I do use wifi internet, and so I was assuming maybe that could be the issue? I'm not
    sure if maybe the internet being disconnected and reconnected extremely fast ....
  4. Shared Hosting Account Server Update - Known Issues And Solutions
    (33)
    Hi Trap17 hosting members. First of all I would like to thank you hosting members for staying
    patient during these difficult times. Xistosupport.com announced Data Center (DC) migration to
    bigger facility for the growing demand. This is to provide much more reliable service to all free
    web hosting members. However it did not go smoothly as server technicians hoped. Even with their
    relentless efforts to bring the service back online there are some known issues which I'd like
    to address. The first issue is that those with TLD (top level domain) will notice that pini....
  5. Server Issues? Web Site Down? Cpanel Access?
    Server Migration issues to report. (48)
    I tried downloading my email from website this morning and Thunderbird said it couldn't access
    it the server. Then I tried loading my website - to no avail. Does anyone have any idea what's
    going on? Is anyone else experiencing this? Seems like this is the second time this spring this has
    happened. Is an upgrade going on, or something? Thanks in advance for your help! ....
  6. Ubuntu 7.10 Boot Issues
    why does this happen? (5)
    hey trapsters, a few months ago, i reinstalled my laptop because i noticed it was getting
    considerably laggy. i first installed xp, however i didn't have the time to install ubuntu as
    well (dual boot) until around about a week ago. for some reason, however, my ubuntu 7.10 takes an
    awfully long time to boot. firstly, after the splash (ubuntu logo and loading bar), the common unix
    printing system (cupsd) takes about 30secs - 1min to load. then, once typing in my username and
    password, ubuntu goes through this very strange process of desktop switching before i actuall....
  7. Safety Issues?
    (0)
    I think we should have a subforum to specifically discuss safety issues, problems, threat on the
    street, downtown, our homes, foreign countries, remote places etc. Also to share some practical tips
    to protect and defend ourselves. We don't wanna live in fear. For example : JAKARTA (JP): Two
    women, both foreign nationals, were robbed Saturday night in a taxi they hailed in Kemang. At
    around 9 p.m., the two women entered a taxi on Jl. Kemang Raya in South Jakarta. After driving for
    several minutes on the same road, the driver slowed the taxi and two men jumped into ....
  8. Image Calling Problem Solved
    I was having issues trying to call an image from a folder. (1)
    Alright so this is for example You'd have a site and the structure is like this.
    http://www.url.com/ a folder of images /images/ and some pages in this parent directory. However,
    I have another folder so it's http://www.url.com/other/ and this index page needs to call
    things from http://www.url.com/images/ and it can't. It won't load. I've had the
    call be to CODE <img src="images/" or <img src="../images/" and
    <img src="http://www.url.com/images/" It doesn't work. I can't....
  9. My Friend Is Having Relationship Issues
    (5)
    Hi peoples. My super close friend is having some relationship issues. She is now really jealous of
    me. And I can't get him to dump her, because he doesn't want to hurt her, but 4 of his
    friends (myself included) want them to break up. He sorta wants to do it, but he's not so sure.
    Comments?....
  10. Php Sessions And Post Variables Issues
    My script dosent seem to work as intended (1)
    You can test it out for yourself at http://sonesay.trap17.com/application.php I've been
    working on this page locally and it seems to be working fine but when I upload it to my trap17
    account the post variables dont get saved properly. Fill in some fields and submit it, the form
    will come up as a empty field yet when you resubmit it without any modifications and the data you
    entered in orginally will now magically appear, resubmit it again and it will be gone. This is
    really annoying as I have no clue why it would be doing this when it seems to work fine locally.....
  11. Unable To Renew Ip Address Or Connect To Internet After Broadband Software Uninstall
    issues after removing DSL software (6)
    How many of you experienced this? QUOTE Unable to renew IP address Unable to start RPC service
    You invite a broadband service, i.e. Verizon DSL, and they provide you with an installation disk.
    You gladly use it but later you add LAN to your home and decide to add a router. You follow the
    manufacturer's instruction and set up your home network. But this is strange... the computer you
    were able to connect to the internet just before a home network is now cannot connect to the
    internet. And according to the router manual you installed the program correctly but ....
  12. Ftp Trap17 Account Help Please
    cPanel issues and can't upload files (14)
    A few days ago I tried to log into cPanel on my site ( www.liamssite.trap17.com ) and it didnt work.
    Also, whenever I try to upload a file (I use filezilla) I get this: QUOTE Status: Resolving
    IP-Address for liamssite.trap17.com Status: Connecting to 64.69.46.210:21... Status: Connection
    established, waiting for welcome message... Response: 220---------- Welcome to Pure-FTPd ----------
    Response: 220-You are user number 2 of 50 allowed. Response: 220-Local time is now 11:31. Server
    port: 21. Response: 220-This is a private system - No anonymous login Response: 220-....
  13. Health Issues Deluxe
    (0)
    My family has so many health issues... My sister has A.D.D and Autism.... My mom had 2 broken legs,
    broken arm, broken shoulder, plus skin graphing done, and much more .... My grandpa had a heart
    attack.... My other grandpa had knee replacement surgery My grandma had a stroke and is paralyzed I
    myself got in 3 car crashes, breaking bones in every 1 And don't even get me started with uncles
    and aunts, it's a big mess I tell you......
  14. Adsense Issues
    (2)
    I'm thinking of getting AdSense but I have a few queries: -Is AdSense entirely free? -Can Google
    access any of your information? -How much, on average, do you get per click? Thanks, MiniK....
  15. Attention Seeking, Or Serious Issues?
    my friend's "dilemma" (5)
    Is my friend attention seeking, or does she just have some serious issues? She used to be a really
    close friend of mine. We'd only hang out at school and sometimes afterwards, but still quite
    close. Only it seems like she can think of some great big lies. Such as once, she claimed her
    mother had hit her for no apparent reason, and this was why she ran away from home one evening, in
    Spring this year. After hearing this story and talking to my friend about it for a few days
    afterwards, it turned out to be that my friend was giving "her mother cheek", so her mother t....
  16. Centered Div Layout Issues
    Float Right item not vertically aligned with text (2)
    Hey everyone. I am writing an all div layout for my friends website and i just cant seem to get all
    the fields aligned properly. I can get all my images to be aligned and look great until i put any
    text on the site. For example, my box that will contain links and such has 3 parts: top, middle and
    bottom. Each of these have 3 parts: left, middle and right. To program the 3 parts of each row, i
    use 3 divs which are all floated based on their position. However, as soon as I put text in the
    middle area, the right image is moved down to a new line. The sample site is located ....
  17. Roasting Your Own Coffee
    Bean selection (5)
    So I'm about ready to roast our coffee here so it's as fresh as can be and I'm all
    set up, except I could use more airtight containers to store said roasted coffee beans in, and
    rearing to go. Now for the selection of beans to order. There are hundreds of choices from all
    across the world and I really don't have much of a clue what I want. I'm thinking about
    ordering a sampler from one company and going from there, but even then, a sampler is only five
    different beans. So many choices, so little time. Anyone else roast their own coffee at home?....
  18. Using Multiple Selection Array In Table To Order Data
    Using multiple selection array in table to order data (1)
    have a form that has a multiple select choice, like this: CODE <form method="post"
    action="display.php" <select multiple name="selectsort[]">
    <option value="code">Code</option> <option
    value="amount">Amount</option> <option value="dateammended">Date
    Ammended</option> <option value="expreviewdate">Expiration/Review
    Date</option> <option value="effectivedate">Effective Date</option>
    <option value="e....
  19. Selection Problem
    (4)
    I need help on a join, I think I have it mostly done, but I know my syntax isn't right. First
    off, to give you an idea, I have two tables, plus my session variables. I'm first selecting from
    the table: user_resources where the user_id = that of the $_SESSION's, and in
    user_resources, there are three fields, user_id, resource_id, and amount, and I wish to print all of
    this. But the hitch to it is, resource_id is an integer. In another table called resources, are the
    fields id and name. The resource_id = resources.id, and I want to print the name associat....
  20. Issues Pointing Domain To The Right Nameservers... [resolved]
    (13)
    Allright so yeah... Just got hosted at computinghost got the s9 package or w/e... anyways... heres
    what dns reports says... http://www.dnsstuff.com/tools/dnsreport.ch...clashofages.com and yeah...
    the nameservers are what we have in our account info when we login any ideas to why this is not
    working? (we registered the account with the same domain name that we are trying to point here...)....
  21. Im Having I.explorer Issues
    (7)
    hi, im having an issue.. i have a window stuck in my desktop and i can't get rid of it.. i
    can't see the toolbar at the top to exit out and i have restarted the computer but it will not
    go away. its stuck right there. how can i get rid of it? or is ther way to move it down?? its not a
    full screen window.. its only like 1/3.....
  22. Paris Hilton Released On Health Issues
    (10)
    Wow this story does not make much sense to me. So first, the judge released her just 4 days after
    she first entered the prison because of "health issues." Seriously? What health issues could Paris
    Hilton possible have? I mean, don't you think it is kind of weird that these miraculous health
    issues didn't keep her out of jail in the first place? And then the judge let her off on house
    arrest. O my, what a horrible punishment. I have to stay in my multimillion dollar mansion for a
    whole month. DARN poor me. THEN, the judge called her back to court and told her she ....
  23. Frontpage Issues
    :( (2)
    When I try to publish my site using Frontpage, it gives me a Frontpage Security Violation error and
    won't publish. When i use FTP, the server extensions won't work at all. I've tried
    re-installing the extensions multiple times, but nothing helps. What's wrong?....
  24. Proxy Issues
    when trying to connect to chats (2)
    hey, im having a problem with this proxy thing, when i try to join a chatroom it keeps saying "Open
    Proxy". what does it mean? how can i change it so im able to go into chatrooms? im using internet
    explorer and windows vista.....
  25. Css Issues
    What is IE7 doing? (5)
    Does anyone know of a quick fix to the css problems in IE7? I am making a website for my college and
    all browsers except ie7 are showing it correctly. (Right now I am using a resolution test to fix
    this.)....
  26. Talk About Weight, Make Up ,money. Basically Being Vain
    Issues.... Issues And More Issues (2)
    Hi, I just wanted to know your opinion on girls and guys obsesed about their external features, Be
    it their looks or their posessions like gadgets and cars and so on. You see girls obsessed about
    their weight even though they might be thin or guys worried about being single or a virgin or his
    posessions. Basically we are in a period of being vain. I understand the importance of looking good
    or atleast looking decent but Girls and their weight and make up and guys with their toys and girls.
    Dont you think that we are pushing it a bit . I mean you hear of skinny models....
  27. Windows Xp Issues
    log-in screen (6)
    Hey, today when i was about to shut down my computer, i accidently clicked the LOG OUT button and
    than logged off.. but now whenever i restart my computer that log-in screen always pops up.. anyone
    have any idea how i can get rid of this? whenver i try to shut down my computer now, it comes up to
    so i don't want to see it.. how can i get rid of it?....
  28. I Have Severe Anger Issues...
    (56)
    A good portion of the time im pretty laid back, and I let things go by me. But it seems latley, I
    get so angry about everything. I get angry if i dont get my way, which isn't really how i
    normally am, i normally don't care. Or i get angry, if someone likes something, because i dont
    think they should because i either do, or i dont so really no one can win with me. The biggest thing
    is, if i used to like something, and became friends with someone because they liked it, and now we
    or atleast i hate them, when i see/hear/do that thing, i get so angry, and I just want....
  29. Help With Counter Strike Source
    some general issues ... (6)
    was having trouble with my CS:S last night and found these FAQ's really helpful .. Q-How come
    there are only two player models?! A-VALVe has decided to wait for an update to give us more
    player models. Expect the other ones in an update soon. Q-How come when I try to add a bot into my
    server it says that they are only available in the beta? A-VALVe has not yet enabeled the bots and
    forgot to remove the beta message. Expect bots in a future update. Q-What is up with the hostages?
    They are HUGE!! A-Yea, they appear to be huge. Through first and third-per....
  30. Delta Airlines Has Issues
    Worst Flying Experience of My Life (10)
    This will be a long post so get ready /laugh.gif" style="vertical-align:middle" emoid=":lol:"
    border="0" alt="laugh.gif" /> The Trip There It is 6:15 a.m. in Richmond, Virginia, United
    States of America. My alarm rings, you know, one of those obnoxious ones. I am very excited, because
    I am on my way to Ft. Lauderdale, Florida, United States of America, to play 45 holes of golf on
    Martin Luther King Jr. Weekend. I arrive at the airport at 7:00 in the morning for a 8:00 plane.
    Right on time, yes! We curbside check, and get to the gate at 7:15. A human come....

    1. Looking for sql, selection, issues

Searching Video's for sql, selection, issues
Similar
Installing
And Running
Glype Proxy
Issues
Uploading A
File
[resolved]
Issues With
Router
Freezing
Shared
Hosting
Account
Server
Update -
Known Issues
And
Solutions
Server
Issues? Web
Site Down?
Cpanel
Access? -
Server
Migration
issues to
report.
Ubuntu 7.10
Boot Issues
- why does
this happen?
Safety
Issues?
Image
Calling
Problem
Solved - I
was having
issues
trying to
call an
image from a
folder.
My Friend Is
Having
Relationship
Issues
Php Sessions
And Post
Variables
Issues - My
script
dosent seem
to work as
intended
Unable To
Renew Ip
Address Or
Connect To
Internet
After
Broadband
Software
Uninstall -
issues after
removing DSL
software
Ftp Trap17
Account Help
Please -
cPanel
issues and
can't
upload files
Health
Issues
Deluxe
Adsense
Issues
Attention
Seeking, Or
Serious
Issues? - my
friend's
"dilemma
"
Centered Div
Layout
Issues -
Float Right
item not
vertically
aligned with
text
Roasting
Your Own
Coffee -
Bean
selection
Using
Multiple
Selection
Array In
Table To
Order Data -
Using
multiple
selection
array in
table to
order data
Selection
Problem
Issues
Pointing
Domain To
The Right
Nameservers.
..
[resolved]
Im Having
I.explorer
Issues
Paris Hilton
Released On
Health
Issues
Frontpage
Issues - :(
Proxy Issues
- when
trying to
connect to
chats
Css Issues -
What is IE7
doing?
Talk About
Weight, Make
Up ,money.
Basically
Being Vain -
Issues....
Issues And
More Issues
Windows Xp
Issues -
log-in
screen
I Have
Severe Anger
Issues...
Help With
Counter
Strike
Source -
some general
issues ...
Delta
Airlines Has
Issues -
Worst Flying
Experience
of My Life
advertisement



Sql Selection Issues



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE