Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

SQL LIKE AND

Heyas,

Just a query is there a way you can combine and AND and LIKE statement for instance
select *
From galaxy
Where planets = "A"
AND constellation is LIKE 'NE%"

Cheers.
0
Zack
Asked:
Zack
1 Solution
 
X_layerCommented:
Try:
select *
From galaxy
Where ((planets = "A") AND (constellation is LIKE "NE%"))
0
 
EyalCommented:
select *
From galaxy
Where ((planets = "A") AND (constellation LIKE "NE%"))
0
 
Lee SavidgeCommented:
select *
From galaxy
Where planets = 'A'
AND constellation LIKE 'NE%'

or

select *
From galaxy
Where planets = 'A'
AND constellation LIKE '%NE%'
0
 
ReubenwelshCommented:
Why not:


select *
From galaxy
Where planets = "A"
AND constellation = "NE%"

Wont that give you the same effect? i dont see why you would want to add a LIKE
0
 
ZackGeneral IT Goto GuyAuthor Commented:
Thank you for the tip
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now