1
Answer

how can insert multiple row value to single row value

Hi friends

My first table contain one row
My second table contain three rows

for example
In first table

  1)  10022  kathir   

In second table

1)  2002     morning     
2) 2003      evening
3)2004       day


I want to enter as below in a new table

10022     2002
10022     2003
10022     2004


How can i make query for this result.please help me





Answers (1)
0
Manish kumar

Manish kumar

NA 30 2.1k 8y
can any body solve this SQL code running total, it is not working  MS ACCESS Database?
 
ID-OrderID-OrderDate-Amount-Running_Total
1-1-11/11/2016-120-120
2-2-11/11/2016-40-160
3-3-11/11/2016-30-190
4-4-11/11/2016-80-270
 
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*"%>
<%@ page import="java.util.Calendar" %>
<%
//java Code 25/11/2016

try
{
String date = (new java.util.Date()).toString();
String OrderDate=request.getParameter("OrderDate");


int OrderID = Integer.parseInt(request.getParameter("OrderID"));
int Amount = Integer.parseInt(request.getParameter("Amount"));
int Running_Total=Integer.parseInt(request.getParameter("Running_Total"));

String sql_debit="select OrderID,OrderDate,Amount,(select sum(Amount) from CustomerOrders where OrderID <= OrderID)'Running_Total' from CustomerOrders";
String s="jdbc:odbc:Database2";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(s);
Statement pstmt=conn.createStatement();
Calendar calendar = Calendar.getInstance();
java.sql.Date startDate = new java.sql.Date(calendar.getTime().getTime());

ResultSet result = pstmt.executeQuery(sql_debit);
//int count = 0;
while (result.next())
{
//result.getInt("Running_Total");
Running_Total = result.getInt(1);
//result.getInt(1);
String output = "User #%d: %s ";
System.out.println(String.format(output, Running_Total));
}
conn.close();
}
catch(Exception ex)
{
System.err.println(ex.getMessage());
}
%>

</body>
</html> 
0
Akshay Phadke

Akshay Phadke

NA 16.7k 1.3m 8y
Use regex those are best for validation for phonenumbers,pincode and so on
http://stackoverflow.com/questions/28716539/how-to-validate-pin-code-mobile-number-and-email-in-javascript
For saving and rerieving images
http://stackoverflow.com/questions/21452418/source-code-to-store-image-into-mysql-database-and-retrieve-it-and-display-in-js