[Solved] multiply and SUM() MS SQL

@fia Maybe you should do your calculation elsewhere first for example on paper or in Excel to ensure you know exactly what you should get. It would also help you figure out the order of the calculation before writing it in SQL. According to the figures shown the values you’ve stated seems to be correct … Read more

[Solved] XML nodes with SQL

Please try the following solution. What we are doing here is called shredding, i.e. converting XML into rectangular/relational format. I am shooting from the hip because DDL and sample data population were not provided. The provided XML is not well-formed due to missing root element, but SQL Server allows to handle XML fragments. We are … Read more

[Solved] Textbox as Input in an SQL Query in Access

No code needed – as @Nathan_Sav said a – a quick search will find what you’re after (I find “reference main form from subform” gives the best page at the top – http://access.mvps.org/access/forms/frm0031.htm ) SELECT * FROM Employees WHERE [First Name]=Forms![Form1]![txtFirstName] AND [Last Name]=Forms![Form1]![txtLastName] txtFirstName & txtLastName are the names I gave to the text … Read more

[Solved] I am inserting excel sheet bulk data into a sql database table, now i need to split the table into multiple tables by using stored procedure [closed]

I assume that you want to dumb the data from bulk_data to myaccount table, business_setup table and business_info table. if so, Assumptions : – Column names with prefix myaccount_ belongs to myaccount table – Column names with prefix business_setup belongs to business_setup table – Column names with prefix business_info belongs to business_info table – complete … Read more

[Solved] How to add a line with this sign “|” in between every column in java program ? What is the logic for loop? [closed]

Its simple: Let’s assume your each column is 15 characters wide, if it’s less or more change accordingly: // Format header System.out.println(String.format(“%1$-15s”, “EMPO” )+ “|”+”\t”+String.format(“%1$-15s”, “ENAME” )+ “|”+”\t”+String.format(“%1$15s”, “SAL” )+ “|”+”\t”+String.format(“%1$15s”, “AVERAGE” )+ “|”); Similarly format your row: I leave this one for you to practice. System.out.println(eno+”\t”+ename+”\t”+sal+”\t”+avg); If you are not able to figure out, … Read more

[Solved] How to get search result by a keyword from different table in MySQL for php? [closed]

Maybe something like this? SELECT p.title, p.model_no, b.brand_name, c.category_title, s.specification_title FROM tbl_product AS p LEFT JOIN tbl_brand AS b ON b.id = p.brand_id LEFT JOIN tbl_category AS c ON c.id = p.category_id LEFT JOIN tbl_product_specification AS s ON s.product_id = p.id WHERE p.title LIKE ‘keyword’ OR p.model_no LIKE ‘keyword’ OR b.brand_name LIKE ‘keyword’ OR c.category_title … Read more

[Solved] PHP check for existing entry in database [closed]

Use PDO like this, PDO and mysql_* functions not working together, you have to use them separately $sth = $dbh->prepare(‘SELECT COUNT(username) FROM users WHERE username= :username GROUP BY username’); $sth->bindParam(‘:username’, $username, PDO::PARAM_STR); $sth->execute(); if ($sth->fetchColumn() > 0) { echo “username taken”; } 2 solved PHP check for existing entry in database [closed]

[Solved] SQL group data based on a column and pivot rows to (unknown) columns [duplicate]

A straight-up PIVOT in concert row_number() with should do the trick Select * From ( Select ID = fd_Interpretation ,Item = concat(‘Word’,row_number() over (partition by fd_Interpretation order by fd_Word) ) ,Value = fd_Word From YourTable ) src Pivot ( max( Value ) for Item in ([Word1],[Word2],[Word3],[Word4],[Word5],[Word6],[Word7],[Word8]) ) pvt 2 solved SQL group data based on … Read more