• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
my query donsn't return any record

#1
Who knows what the problem is? 

PHP Code:
SELECT `track`.`id`, `track`.`artist_id`, `track`.`genre_id`, `track`.`title`, `track`.`cover`, `track`.`exclusive`, `track`.`count_download`, `track`.`url`, `artists`.`id` `artid`, `artists`.`artist_name`, `g`.`id` `gid`, `g`.`name`
FROM `track`
JOIN `artistsON `artists`.`id` = `artist_id`
JOIN `genres` AS `gON `g`.`id` = `genre_id`
WHERE LOWER(track.titleLIKE 'Bass%' 
Reply

#2
How can a LOWER()ed value start with a capital letter?
Reply

#3
(08-31-2017, 05:43 AM)Narf Wrote: How can a LOWER()ed value start with a capital letter?

mysql does not care. abcd is the same as AbCd (depend on the character collation). Does postgresql the same?

I believe programmer use mysql and is a beginner. programmer delete an artists or genres and forgot to check if the value is needed.

@programmer,
A join is in mysql a inner join. If the artist_id or genre_id is null or the id value does not exist in artists/genres you get no records.
Reply

#4
@programmer,

More information please...
What database are you using? Version?
Based on your joins what are you expecting to see?
Are you sure that you are using the correct join?
Reply

#5
Run the query in PhpMyAdmin. Is it giving any results?
Reply

#6
Looks like you got syntax error in join such as
JOIN `artists` ON `artists`.`id` = `artist_id`
JOIN `genres` AS `g` ON `g`.`id` = `genre_id`

I think it should have been
JOIN `artists` ON `artists`.`id` = `track`.`artist_id`
JOIN `genres` AS `g` ON `g`.`id` = `track`.`genre_id`

such as missing track

Regards
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.