[Solved] Which phone has got high sales in each year?

In the derived table the total sales are calculated at ( year,phone ) combination. Once the total sales are calculated all the top rows( rank = 1 by sales ) should be identified for each year. By using correlated sub-queries and having clause the first row is identified from each group( year ) and displayed … Read more

[Solved] SQL Replace Command needed [closed]

This is a very basic update command. I would recommend reviewing this tutorial : http://www.w3schools.com/sql/ I will give you the command for now though : UPDATE shop SET product_price = 3.2 WHERE product_country = ‘USA’; This is assuming product_price is a decimal type and product_country is a varchar or some other type of text based … Read more

[Solved] what the meaning of this code in sql? i found this code in oracle apex and that says that query for data change history

select xxpst_util_pkg.get_type_id_by_code (‘CHANGE_REQUEST’, ‘MILESTONE_DUE_DATE_CHANGE’) comment_type_id from dual is a mean of calling a PLSQL function from a SQL statement. DUAL returns a single row, so it just yields the output of the function. It’s not dissimilar from doing my_variable := xxpst_util_pkg.get_type_id_by_code (‘CHANGE_REQUEST’, ‘MILESTONE_DUE_DATE_CHANGE’) In terms of what comes back, you’d need to look in the … Read more

[Solved] Insert an image in a column of a table that already has 5 columns

I’m not sure you can do that the way you’re trying, Why don’t you load the image into a variable then use that variable in your insert statement: declare @image varbinary(max) set @image = (SELECT BulkColumn from Openrowset( Bulk ‘C:\Users\Yassine-Kira\Desktop\Templates\ProductImg\elite-book_tcm_133_1096796.png’, Single_Blob) as BikeImage) insert into dbo.Produit values (‘Pc portable’, ‘HP EliteBook série p’, ‘Un ordinateur…’, … Read more

[Solved] Joining two SQL tables in Microsoft SQL server 2012 to get a certain format [closed]

After re-reading your question, I think this is what you are looking for: SELECT e.Department_ID , e.Employee_Name AS Col1 , e.Total_Hours FROM Employee e UNION ALL SELECT d.Department_ID , d.Department_Name AS Col1 , SUM(e.Total_Hours) FROM Employee e JOIN Department d ON e.Department_ID = d.Department_ID GROUP BY d.Department_ID , d.Department_Name ORDER BY Department_ID ASC , Total_Hours … Read more

[Solved] Search query using php and mysql [closed]

Try this: $query = “select * from table_name where 1 “; if(!empty($_POST[‘field1’]) ) { $query .= ” AND field1 like ‘”.trim($_POST[‘field1’]).”‘”; } if(!empty($_POST[‘field2’])) { $query .= ” AND field2 like ‘”.trim($_POST[‘field2’]).”‘”; } // and so on $result = mysql_query($query); 1 solved Search query using php and mysql [closed]

[Solved] Execute query using C# [closed]

SqlCommand has ExecuteReader, for executing the command and returning a dataset, ExecuteScalar for returning a single value of a primitive type (int, string, etc.), or executeNonQuery for returning nothing. You can also pass a command to a SqlDataAdapter, and use that to populate a DataTable object. Please google SqlCommand and you will find LOTS of … Read more

[Solved] SQL db and Combobox [closed]

So here we go. I will help you with such task. First get list of databases. Then get list of tables (parameter is Connection string, where you should add the name of the database you have choosen in your combobox. public List<string> GetDatabaseList() { List<string> list = new List<string>(); string conString = “Data Source=yourDataSource; Integrated … Read more

[Solved] php mysql_fetch_array() error [duplicate]

when you run a DELETE command, I believe nothing is returned, thus you can’t mysql_fetch_array(). You would normally use that if you’re doing a SELECT. in this case, you’re deleting something, so just remove that loop, and echo(). solved php mysql_fetch_array() error [duplicate]

[Solved] How to make SQL Script like this? [closed]

You can try like following using GROUP BY and UNION ALL. select count(*) CT,Mark from TableName group by Mark union all select Count(*), ‘A+B’ as mark from TableName where mark in(‘A’,’B’) UNION ALL select Count(*), ‘A+C’ as mark from TableName where mark in(‘A’,’C’) union all select Count(*), ‘B+C’ as mark from TableName where mark in(‘B’,’C’) … Read more