Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: MySQL

by screamingeagle (Curate)
on Jul 18, 2002 at 22:50 UTC ( #183074=note: print w/replies, xml ) Need Help??


in reply to Filtering MySQL results

you're enclosing the column names and the table names in single quotes. try removing them ...and add the where clause like stajich suggested :
$sth = $dbh->prepare("SELECT username,password,group FROM users where +group = 'Admin'"); $sth->execute;
In SQL Server, the check is not case-sensitive, however , if you're using oracle, you might want to write the SQL Stmt like this :
SELECT username,password,group FROM users where upper(group) = upper('admin')
hth...

Replies are listed 'Best First'.
Re: Re: MySQL
by thor (Priest) on Jul 19, 2002 at 11:58 UTC
    screamingeagle wrote:

    In SQL Server, the check is not case-sensitive, however , if you're using oracle, you might want to write the SQL Stmt like this :

    SELECT username,password,group FROM users where upper(group) = upper('admin')
    The problem with this is that unless the database engine is very advanced, this will table scan instead of using an index. The reason is that it needs to run a function on one of your columns, and the optimizer has no idea what the result of that function call will be before hand. So, it needs to calculate it for every row when you do your query.

    You are in luck, however, in that there are alternative solutions to the problem. One is to create a rule on the column that only allows certain known values. The second is to have the upper in your insert statement, thus canonicalizing the values in the column. I'm sure there are more, but this should get you started.

    thor

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://183074]
help
Chatterbox?
[marto]: I'll be interested to see what difference in terms of file size/quality the new codecs make. I enjoy working on things like this, so that's a bonus
[Corion]: Ah, cool! So it's not an inhouse youtube but for a wider consumption
[marto]: last time it was IE6 clients, now they're on 11, so more scope there also, in terms of UI and playback
[marto]: in house as in Company network, not internet connected (power stations and the corporate HQs)
[Discipulus]: new Monsignor party! free beverages and pizza for all you monks! and a big thanks for the patience you deserved me during these years
[marto]: congrats Discipulus
[Discipulus]: only 4k points to sundial's level ..;=)
[Corion]: Yay Discipulus ;)
[Corion]: marto: Ah, so this will be training videos etc., cool!
[choroba]: Congratulations!

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2017-07-28 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (425 votes). Check out past polls.