[Solved] Selecting Data from data base SQL

try this one first away to get data. $check = DB::select(“select * from accounts where username = ?”,[$data[‘username’]]); second away to get data. $check = DB::select(“select * from accounts where username = :userName”,[‘userName’ => $data[‘username’]]); 1 solved Selecting Data from data base SQL

[Solved] String cannot be of zero length error [closed]

You need to check if the area contains a hyphen. Otherwise Row.Area.Substring(0, Row.Area.IndexOf(“-“) + 1) will return an empty string, and passing the empty string to Replace is what is causing the error. So (and please excuse any invalid VB.Net) If Row.Area.Contains(“-“) Then Dim area As String = Row.Area.Substring(0, Row.Area.IndexOf(“-“) + 1) Row.Area = Row.Area.Replace(area, … Read more

[Solved] joins on multiple keys in linq [closed]

Try code like this using System.Collections.ObjectModel; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace ConsoleApplication57 { class Program { static void Main(string[] args) { int employeeId = 113; List<E_JOURNAL> employee = E_JOURNAL.journals.Where(x => x.JOURNALID == employeeId).ToList(); var results = (from j in employee join s in E_ABSENCE.absenses on j.JOURNALID equals s.JOURNALID orderby … Read more

[Solved] How to order posts by date added [closed]

You want to sort on the datetime (or if that doesn’t exist you could use the ID, but that is not how “it should be”) in descending order instead of ascending. Example query: SELECT `title`, `text` FROM `news` ORDER BY `datetime` DESC LIMIT 5 https://dev.mysql.com/doc/refman/5.7/en/sorting-rows.html solved How to order posts by date added [closed]

[Solved] SQL SUM COLUMN FROM A SAME TABLE AND Multi ids

You can use a recursive CTE to get all the linked users: with recursive u as (select t.id, t.`Referral id`, t.Balance from yourtable t where id = 1 union select t.id, t.`Referral id`, t.Balance from u inner join yourtable t on u.id = t.`Referral id`) (select sum(Balance) from u) Fiddle 0 solved SQL SUM COLUMN … Read more

[Solved] SQL query to get the multiple “,” positions from a string

Please try this one it will give output as yours. Create table #Table (rowNo int identity(1,1), ID varchar(100)) insert into #Table values(‘32132’) insert into #Table values(‘32132,32132’) insert into #Table values(‘32132,32132,6456,654,645’) declare @TableRow int = (select count(*) from #Table),@Tableloop int = 1 while(@Tableloop <= @TableRow) begin Declare @var varchar(100) ; SET @var = (select ID from … Read more

[Solved] I have 3 table missing data find in SQL

If you cross join your Week and Student tables to get all combinations, and then use not exists to determine where no TimeSheet record exists. select W.WeekID, S.StudentID from [Week] W cross join Student S where not exists (select 1 from TimeSheet T where T.StudentID = S.StudentID and T.WeekID = W.WeekID); 0 solved I have … Read more

[Solved] MYSQL search result

Try to avoid posting same question in other ways, edit the same question. You asked the same question in MYSQL OR not working Hope this will really help you:- try { $keyword = trim($_GET[“keyword”]); if ($keyword <> “” ) { $sql = “SELECT * FROM tbl_contacts WHERE 1 AND ” . ” (first_name LIKE :keyword … Read more

[Solved] difference -in “Create databse” and “create database if not exists”

CREATE DATABASE IF NOT EXISTS database_name will execute the CREATE DATABASE database_name only if the database_name does not already exist. If the database_name does not exit, both queries will do the same job, that is they create the database_name. If the database_name exits, CREATE DATABASE database_name will return an error similar to “the database ‘database_name’ … Read more

[Solved] SQL – Temptable Identity Column not working [duplicate]

You have defined three columns in the INSERT INTO statement – but the SELECT only provides two. Change your code to so you’re not inserting values into your IDENTITY column: — NOT NEEDED! SET IDENTITY_INSERT #TEMPTABLE ON; INSERT INTO #TEMPTABLE(CARDNO, OFFICEPUNCH) SELECT CARDNO, OFFICEPUNCH FROM [Tempdata] — NOT NEEDED! SET IDENTITY_INSERT #TEMPTABLE OFF; 1 solved … Read more