| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |
|

05-29-07, 08:23
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 194
|
|
|
How to use the LIKE operator on a table column
|
|
hi,
How do you use the LIKE operator on a table column using a wildcard?
e.g. Select * from tbl_employees WHERE 'Permanent' LIKE emptype;
emptype is a column name of type varchar but i want to add a wildcard to it like the following example:
Select * from tbl_employees WHERE emptype LIKE '%Permanent%';
Dont ask me why i want to do it like the first example - its just some wierd thing am trying to do!
The first example does work but cant seem to find the syntax if there is one to add a wildcard to the tbl column part.
|
|

05-29-07, 08:34
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
Quote:
|
Originally Posted by ozzii
...add a wildcard to the tbl column part.
|
Code:
... LIKE '%' + emptype + '%'
I think... Maybe... Perhaps 
|
|

05-29-07, 09:23
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
|
|
george, mysql does not use the plus sign for concatenation
try to keep up, man 
|
|

05-29-07, 09:23
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
Quote:
|
Originally Posted by ozzii
Dont ask me why i want to do it like the first example - its just some wierd thing am trying to do!
|
okay, i won't ask
but perhaps you might like to show us a few sample rows of data, and then show what the query should return
|
|

05-29-07, 09:24
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
Oooh apologies!
What be thine concatenator?
|
|

05-29-07, 09:33
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
Quote:
|
Originally Posted by georgev
Oooh apologies!
What be thine concatenator?
|
where be thy fine manual?
|
|

05-29-07, 09:35
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
[beam]I don't have one[/beam]
I don't have access to a MySQL database - I only know some theory, not practice 
I suppose I could go look it up - but it'd probably be more beneficial for the OP to do so 
|
|

05-29-07, 09:44
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
|
|

05-29-07, 09:52
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
Should being the operative word 
The company I work for hardly uses it ~ I think it might just be our external site that has a tiny little MySQL db somewhere.
I guess I use this as my learning resource  I try chip in a few cents here and there!
|
|

05-29-07, 09:54
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
your company has nothing to do with what you have on your home computer
and yes, i said "should", not "could" -- it's a rather more forceful suggestion

|
|

05-29-07, 10:18
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
The website link doesn't want to work - keeps timing out...
Silly question time: Where can I get a copy of MySQL that I can use on my home PC? In fact, I should probably start a newbie thread for this... 
|
|

05-29-07, 10:28
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
Quote:
|
Originally Posted by georgev
The website link doesn't want to work - keeps timing out...
|
check your corporate firewall, mebbe dey don wan you skivin'...
Quote:
|
Originally Posted by georgev
Silly question time: Where can I get a copy of MySQL that I can use on my home PC?
|
on the mysql.com web site!!
|
|

05-29-07, 10:48
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
You make me laugh Rudy 
And yeah, I thought it'd be something simple like that  MySQL is the free one, right? It'll work on XP Pro and XP Home / do I need IIS etc...
im askin cos i cnt b bothrd lukin it up myself.
Ach, I'll give the site a read later if I got time 
|
|

05-29-07, 10:54
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
|
|
IIS is used for web publishing, so no, you don't need it
|
|

05-29-07, 10:55
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
*slaps forehead*
It's one of those days again - I'm all giddy - apologies 
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|