.:.:.:.:RTTP.Mobile:.:.:.:.
[<--back] [Home][Pics][News][Ads][Events][Forum][Band][Search]
full forum | bottom

anyone good at SQL?

[views:1129][posts:2]
 ______________________________________
[Feb 7,2006 11:05am - the_reverend ""]
I don't know if this can be done without PLC or something like SPC


I posted this on another forum...
ok, this has been bugging me for a while.
I have 2 tables.

picturetable {index, bandname varchar, path...}
bandtable {index bandname varchar, displayname varchar, bandinfo...}

here is the deal that makes it tricky... there are bandnames in the picturetable that aren't in the bandtable and there are bandnames in the bandtable that arent in the picturetable.

what I am currently doing is:
SELECT pt.bandname as band, bandtable.bandname as btband, bandtable.displayname, bandtable.displayname FROM bandtable RIGHT JOIN (SELECT band FROM \'picturetable\' GROUP BY \'bandname\' ORDER BY \'bandname\') pt on pt.bandname=bandtable.bandname ORDER BY pt.bandname

this shows all the distinct bandnames in the picturetable joined to the bandtable and sorted by bandname.

what I want to do is this PLUS all the bandtable that aren't in the picturetable AND if that weren't enough... I want it sorted by the bandtable.displayname, but if that is null or blank, then order it by pt.bandname.

any for a 3rd part, I would like to cache the query until the number of rows in bandtable or the number of rows in picturetable change.

anyone? I know that's a lot to ask for...
http://www.php-editors.com/forum/index.php...dfca36e7dc71af04&act=ST&f=23&t=2008
http://forums.devshed.com/mysql-help-4/how...ing-and-sort-two-tables-324306.html
 __________________________________
[Feb 7,2006 11:34am - niccolai ""]
try posting it on the dynamic drive forum.

There aren't many, but a couple guys there are really good with mysql/sql.

dynamicdrive.com/forums
 ____________________________________
[Feb 7,2006 12:24pm - anonymous  ""]
that movie sucked


Reply
[login ]
SPAM Filter: re-type this (values are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, or F)
message

top [Vers. 0.12][ 0.006 secs/8 queries][refresh][