English 中文(简体)
选择[第一封从B开始]的所有地点
原标题:Select all where [first letter starts with B]
  • 时间:2012-04-14 20:07:36
  •  标签:
  • mysql

这是对我先前的问题的后续问题。 我想写一份MYSQL声明,与从B封信起的每一条目一致。

职能.php

function getCategory() {
$query = mysql_query("SELECT author FROM lyrics WHERE author [starts with letter B]") or die(mysql_error());
while ($row = mysql_fetch_assoc($query)) { ?>
    <p><a href="##"><?= $row[ author ]; ?></a></p>
    <?php }

类别:

<?php include  includes/header.php  ?>
<?php getCategory(); ?>
<?php include  includes/footer.php  ?>

同我一样。 然后,每 letter一 letter,一 letter误(编号等)

最佳回答
SELECT author FROM lyrics WHERE author LIKE  B% ;

保证您有<条码>的<>正本/条码>索引,但!

问题回答

这项工作将在MYSQL中进行。

SELECT Name FROM Employees WHERE Name REGEXP  ^[B].*$ 

在这一区域进程中,定期表达

以及

这是T-SQL

SELECT Name FROM Employees WHERE Name LIKE  [B]% 

您可以使用:

WHERE LEFT (name_field, 1) =  B ;

声明:

 SELECT * FROM employee WHERE employeeName LIKE  A% ;

结果:

Number of Records: 4

employeeID  employeeName    employeeName    Address City    PostalCode  Country

1           Alam             Wipro          Delhi   Delhi   11005      India

2           Aditya           Wipro          Delhi   Delhi   11005      India

3           Alok             HCL            Delhi   Delhi   11005      India

4           Ashok            IBM            Delhi   Delhi   11005      India

在你发表评论后,有两点是:

  1. 缩略语 http://www.un.org/Depts/DGACM/index_french.htm Just for simplicity. (PHP string营运人)

  2. 插图应与LIKE的操作者相比较。 http://dev.mysql.com/doc/refman/5.0/en/string-comparison-Functions.html“rel=” 缩略语

你也可以尝试

SELECT author FROM lyrics WHERE author LIKE BINARY  N%  ORDER BY id ASC




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签