如何解决SQL查询 [英] how to solve SQL Query
问题描述
我有两个表调用方,客户
发票编号,发票编号,日期的发票表
带客户编号和客户名称的客户表,客户移动
我通过文本框执行searchng
用户可以通过发票编号,客户名称或客户手机搜索..
我必须从数据库中检索发票编号,客户名称,客户移动电话,日期
我尝试此查询...
i have two table invoce,customer
invoice table with invoice no,cumtomerid,date
customer table with cumtumer id,and custumer name,customer mobile
i performering searchng by a textbox
user can search via invoice no or custumer name or customer mobile..
i have to retrieve invoice no,custumer name,customer mobile,date from database
i trying this query...
SELECT invoice.InvoiceNo, invoice.Date, Customer.Name,Customer.MobileNo FROM Customer inner JOIN invoice on invoice.CustomerID=Customer.CustomerID and invoice.InvoiceNo like'ajay%' or Customer.Name like'ajay%' or Customer.MobileNo like'ajay%'
其中ajay是客户名称
但它没有提供适当的答案
请给我解决该问题的方法
where ajay is Customer Name
but its not provide appropriate answer
please gieve me solution of that problem
推荐答案
invoice.InvoiceNo like'ajay%' or Customer.MobileNo like'ajay%'
如何用InvoiceNo,Mobile No检查Ajay?
您应该知道Ajay是客户名称而不是手机号码,发票号码
改变您接受用户输入的方式.使用包含搜索字段CustomerName,InvoiceNo,Mobile No.的下拉列表
首先选择搜索条件,然后在文本框中输入所需的值.
how can you check Ajay with InvoiceNo, Mobile No ?
you should know Ajay is Customer name not Mobile No, invoice No.
change you way of accepting input from user. Use dropdownlist containing search fields CustomerName, InvoiceNo, Mobile No.
first select search criteria and then enter desired value in textbox.
选择invoice.InvoiceNo,invoice.Date,Customer.Name,Customer.MobileNo FROM Customer,发票,其中invoice.CustomerID = Customer. CustomerID和发票.InvoiceNolike''''或Customer.Name如"ajay%"或Customer.MobileNo like''''''
SELECT invoice.InvoiceNo, invoice.Date, Customer.Name,Customer.MobileNo FROM Customer, invoice where invoice.CustomerID=Customer.CustomerID and invoice.InvoiceNo like'''' or Customer.Name like''ajay%'' or Customer.MobileNo like''''
use this query for your ques.
它的查询是正确的,我的pageindexchanging .....
its query is correct,i was wrong with pageindexchanging.....
这篇关于如何解决SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!