[Solved] how to execute a cmd in sql?

You may be simply missing a space between the .php file and the parameter. With your code, the invocation command line would look like this; php C:/xampp/htdocs/sample/sms_send.phpsomething I doubt you have a file with that name. Add a space after .php and see what happens: lclcmd := CONCAT(‘php C:/xampp/htdocs/sample/sms_send.php ‘,’something’); Do post the error messages … Read more

[Solved] How to Update this data using SQL? [duplicate]

Something like this will work: UPDATE yourtable SET yourfield = MID(yourfield,INSTR(yourfield,”/Documents/”)); INSTR locates the position of the string /Documents/, and MID gets everything beginning from there. Notes: This maybe won’t work as you expect it when you have something like /Documents/Documents/ in your path string. Depending on your RDBMS MID and INSTR may not be … Read more

[Solved] Relation to many and get without this

In SQL, this type of query needs what is known as an EXCEPTION JOIN. Some RDBMSs actually implement this as a separate type (such as DB2), while others need to use a workaround. In your case, it amounts to (in SQL): SELECT User.* FROM User LEFT JOIN UserHouse ON UserHouse.id_user = User.id WHERE UserHouse.id_user IS … Read more

[Solved] How to perform an action on one result at a time in a sql query return that should return multiple results?

Use a loop to iterate through the results of your query. SELECT EmailAddress FROM Customers` WHERE EmailFlag = ‘true’` AND DATEDIFF(day, GETDATE(),DateOfVisit) >= 90; Replace day with other units you want to get the difference in, like second, minute etc. c#: foreach(DataRow dr in queryResult.Tables[0].Rows) { string email = dr[“EmailAddress”].ToString(); // Code to send email … Read more

[Solved] SQL Date Variables in Python

I tried this and now it worked query2 =”””insert into table xyz(select * from abc where date_time = %s)””” cur.execute(query2,(rows)) Though, I don’t know why it worked and how is it different from what I was trying earlier solved SQL Date Variables in Python

[Solved] How would I find the second largest salary using MYSQL [closed]

Try this, It should must work. SELECT name, salary FROM employees WHERE salary = (SELECT MAX(salary) FROM employees WHERE salary < (SELECT MAX(salary) FROM employees)) Or you can try this one as well. /* looking for 2nd highest salary — notice the ‘=2’ */ SELECT name,salary FROM employees WHERE salary = (SELECT DISTINCT(salary) FROM employees … Read more

[Solved] How can I select 4 distinct values from 2 tables containing many rows of data in SQL Server?

Something like this? SELECT TOP 4 g.GalleryID ,g.GalleryTitle ,g.GalleryDate ,MAX(m.MediaThumb) AS MaxMediaThumb FROM Galleries g INNER JOIN Media m ON g.GalleryID = m.GalleryID GROUP BY g.GalleryID, g.GalleryTitle, g.GalleryDate 3 solved How can I select 4 distinct values from 2 tables containing many rows of data in SQL Server?

[Solved] accept post data in asp and insert into sql server

It’s mostly VB, just switch to it <%@ Page Language=”VB” %> <%@ Import Namespace=”System.Data.SqlClient” %> <script runat=”server”> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim myConn As SqlConnection = New SqlConnection(“Integrated Security=false;Data Source=.;Initial Catalog=DOMAIN_NAME;UserID=abc;Password=123″) myConn.Open() Dim sqlstring As String = ” INSERT INTO sean.local (etype, latitude, longtitude, phone) VALUES (‘” … Read more

[Solved] Error when running SQL syntax

The error: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given is almost always because you’ve tried to execute a query and it’s failed for some reason, but you’ve continued on blindly anyway. Upon failure, mysqli_query will return false rather than a mysqli_result and, if you then attempt to use that boolean false value … Read more

[Solved] Error while fetching nested loop output [closed]

1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 DECLARE V VARCHAR2(20); BEGIN FOR I IN REVERSE 1..5 LOOP FOR J IN 1..I LOOP V:=V||’ ‘||J; END LOOP; DBMS_OUTPUT.PUT_LINE(V); V:=NULL; END LOOP; END; / 2 solved Error while fetching nested loop output [closed]

[Solved] SELECT COUNT(DISTINCT column) doesn’t work

The distinct keyword is supposed to be outside like below, SELECT DISTINCT column1, column2, … FROM table_name; ? Also, you are trying to sum few things, It should be something like below, SELECT UID, COUNT(UID) AS TOTAL, SUM(CASE WHEN SYSTEM = ‘Android’ THEN 1 ELSE 0 END) AS A, SUM(CASE WHEN SYSTEM = ‘IOS’ THEN … Read more

[Solved] SQL Multiple count on same row with dynamic column

Since you are using SQL Server then you can implement the PIVOT function and if you have an unknown number of period values, then you will need to use dynamic SQL: DECLARE @cols AS NVARCHAR(MAX), @query AS NVARCHAR(MAX) select @cols = STUFF((SELECT distinct ‘,’ + QUOTENAME(‘PeriodId’+cast(periodid as varchar(10))) from Periods FOR XML PATH(”), TYPE ).value(‘.’, … Read more