phpMyAdmin View Question

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Pavilion
Forum Contributor
Posts: 301
Joined: Thu Feb 23, 2012 6:51 am

phpMyAdmin View Question

Post by Pavilion »

Hello - I hope I'm posting this question in the correct place.

I'm using phpMyAdmin and trying to create a very simple view.

Following is the SQL as I "save" it:

Code: Select all

SELECT UserSites_Tbl.User_ID AS SiteUser
FROM UserSites_Tbl
WHERE (((UserSites_Tbl.SiteName)="MySite") AND ((UserSites_Tbl.UserCategory) Like "Org%"))
When I execute the above syntax it works just fine, and returns the records I expect it to return. However... once I save the above syntax as a VIEW, the VIEW returns 0 records. Upon further research, I've found that the above syntax saves as follows:

Code: Select all

SELECT`UserSites_Tbl`.`User_ID` AS `SiteUser` 
FROM`UserSites_Tbl` 
WHERE ((`UserSites_Tbl`.`SiteName` = 'MySite') and (`UserSites_Tbl`.`UserCategory` like '\0\0\0O\0\0\0r\0\0\0g\0\0\0%'))
No matter what I do when "saving" my original syntax, it actually "saves" as the second snippet (hence a result of 0 records).

Does anyone have any ideas as to how I can save the view without it corrupting the Like "Org%" to like '\0\0\0O\0\0\0r\0\0\0g\0\0\0%'?

Thanks in advance -

Pavilion
Pavilion
Forum Contributor
Posts: 301
Joined: Thu Feb 23, 2012 6:51 am

Re: phpMyAdmin View Question

Post by Pavilion »

Well ... I figured it out....

Instead of ...

Code: Select all

LIKE "Org%"
The syntax needs to be ...

Code: Select all

LIKE CONCAT("Org","%")
(syntax is everything) :D
Post Reply