I’m trying to build a Vendor Contact Database with categories. Various vendors are marked under more than one category. I have structured my table as the following: My Current Code This is just a basic idea. My contact database has more fields including phone number, email, etc. Seeing how our category numbers have grown to a large amount, I’m looking
Tag: sql
How to transfer several rows from one table to other table (SQL)
I have two tables TableA and TableB with colums id, login, pass. Also I have a php array: $array = [1,3,5]. How can I transfer rows from TableA to TableB where id equal each value of my array? id is …
Laravel Eloquent, group by month/year
i’m trying to group my data by month and year. The output is : if i group only by month, i don’t know from which year belong this month, my expected output is : i want to do it in sql, not in php. Answer You can try as:
Propel adds CROSS JOIN to query when using an alias to JOIN tables
Trying to do a fairly simple query in Propel 2. I have a Person table and a Possession table – persons can have many possessions but only one of each possession type. So a person can have 1 book, 1 car, etc. I’m trying to write a query in Propel that will return all persons along with their car name
Sql returns empty row on combinning primary key with another value in where clause
I am getting empty row on following sql SELECT * FROM flyers WHERE fId=’6′ AND ‘userId’=’400’ MySQL returned an empty result set (i.e. zero rows). (Query took 0.0004 sec) But when i use SELECT …
how to my receiver is typing a message and show on my browser
i want to check the user is typing a message and want to display it in my chat box, i know setting database flag and checking it by timeinterval function, but i think it should be slow method, is there any way to check it? by the users’s machine ip/id . Answer I have found that using sockets is the
Post date format and select date format from the database
I have a textbox that displays the current date in format: d-m-Y When I save this the date will written to my database like: Y-m-d. For example: the current date is: 02-06-2016. My script writes this to the database as: 2002-06-16. I am using the following code to save the data to my database: What do I need to change
PHP MySql delete query
I have a delete script on my dashboard that WAS working before moving domains. ( not sure if that is relevant ) The code for my ‘deletejob.php’ is below. <?php error_reporting(0); $host = '…
SQL Argument data type int is invalid for argument 1 of charindex function
I’m trying to convert MySQL query to MsSql query but I’m having trouble. Here is my query: MySQL SELECT *, (SELECT count(books.id) FROM books WHERE books.status = 1 AND FIND_IN_SET(…
How to prevent fraud in credit system?
Supposing our accounts table has a column called balance, each transaction is logged in the transactions table. Of course, we should verify there is sufficient funds prior to doing any transactions to sell products. Therefore, for performance purposes we should check the balance column of the user, deduct the amount on a successful sale, and update his balance. However, if