0 votes
in Databases by (2k points)
i want to find data between two dates and display results in table.

code: ps = DbConnection.cn.prepareStatement("SELECT Bill_no, Date, Cust_Name, Contact_No, Reg_No, Model, CC, QTY, Engine_No, Chasis_No, Payment_Mode, Grand_Total FROM stock WHERE date = '$from' and '$to' ");

code does not work.

1 Answer

0 votes
by (1.9k points)

You should use the between operator:

SELECT Bill_no, Date, Cust_Name, Contact_No, Reg_No, Model, CC, QTY, Engine_No, Chasis_No, Payment_Mode, Grand_Total  
FROM   stock 
WHERE date BETWEEN '$from' AND '$to'

 

131 questions

117 answers

7 comments

378 users

Welcome to Todayask Q&A, where you can ask questions and receive answers from other members of the community.
...