473,396 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

in query, how can I compare string?

Hi I wanna put string in query "where" part.

For example,

$sql="select VEHICLE
FROM database
WHERE MECHANIC =BRIAN
";

like above, "mechanic" column is filled with strings. Then how can I
write "where" part?
Above query does not work.
Thanks.

Feb 13 '07 #1
2 18264
kirke (hi******@gmail.com) writes:
Hi I wanna put string in query "where" part.

For example,

$sql="select VEHICLE
FROM database
WHERE MECHANIC =BRIAN
";

like above, "mechanic" column is filled with strings. Then how can I
write "where" part?
Above query does not work.
Does this:

$sql="select VEHICLE FROM database WHERE MECHANIC = 'BRIAN';

Or what do you mean with "filled with strings"?
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 13 '07 #2
Erland Sommarskog wrote:
kirke (hi******@gmail.com) writes:
>Hi I wanna put string in query "where" part.

For example,

$sql="select VEHICLE
FROM database
WHERE MECHANIC =BRIAN
";

like above, "mechanic" column is filled with strings. Then how can I
write "where" part?
Above query does not work.

Does this:

$sql="select VEHICLE FROM database WHERE MECHANIC = 'BRIAN';
Should be
$sql="select VEHICLE FROM database WHERE MECHANIC = 'BRIAN'";

(Normally, I would assume that the user would figure this out,
but in this case the original poster appears to still be at the
stage of struggling with the basics.)
Feb 14 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt | last post by:
if (123 > 33) will return true and if ("123" > 33) will return true So my question is, if the above behaviors are the same?? If string is a number, and compare with another number, it will...
10
by: tvn007 | last post by:
#include <iostream> #include <string> int main (void){ using namespace std; string STR =("TEST"); const std::string::size_type STR_SIZE = STR.size(); int count =0; while ( count <=...
10
by: lovecreatesbea... | last post by:
Is it correct and safe to compare a string object with "", a pair of quotation marks quoted empty string?If the string object: s = ""; does s contain a single '\'? Is it better to use...
1
by: swapnilladhe | last post by:
Hi, I have a array of string and a variable containing string and i code like as; if(String.compare(DFArray,checkBox.name)==0) { alert("R U HERE?"); f=false; ...
2
by: kentek | last post by:
Greetings, Please be gentle as I have never touched SQL Server other that to configure it for Sharepoint MOSS 2007 on Server 2003. I understand some of the SQL Query language but I am at a total...
7
pureenhanoi
by: pureenhanoi | last post by:
Hi bro! Can anyone tell me, how to compare two strings like Operating System compare file names. Example: if i have two string "T*.DOC" and "TIET1.DOC". The comparision operator must return TRUE...
7
by: sigava77 via AccessMonster.com | last post by:
Hi, I have a table with a string field that can store numeric field. How do I make a query to compare this field with a numeric value. Example: Select * from table1 where field1="condition" and...
2
by: kalragarvita | last post by:
I need to put some conditions for query so need to save query as string and then want to put it back to its orignal form.. below is the query "SELECT ""HPD:HelpDesk"".""Case ID+"",...
4
by: ndoe | last post by:
how to compare string in file i mean compare that string content digit or alphabet,and 1 question more can we count that line if first line variable = 1,if read second line variable = 2 and so on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.