I have 200k records in one table and I want to insert these records into another table. I read about the bulk insert but the query I found on msdn website is just not making any sense. This is the query What is f:orderslineitem.tbl and the whole this is just not making any sense. I have a table with four
Tag: sql
How do I solve this (SQL) query? [closed]
This is probably one of the simplest queries ever, and I’m probably just making it harder than it has to be, but I need it done. So, there’s three tables: TABLE AGENT ( A_ID INTEGER PRIMARY KEY, …
Postgres not allowing localhost but works with 127.0.0.1
Postgres not accepting connection if I say -h localhost but it works if I say -h 127.0.0.1 My /var/lib/pgsql/data/pg_hba.conf If I add following line then Postgres service failed to start: Wwhat is wrong there? Update My /etc/hosts file: Answer In pg_hba.conf, the first match counts. The manual: The first rec…
Why does Hibernate generate a CROSS JOIN for an implicit join of a @ManyToOne association?
Baur & King said in their book: Implicit joins are always directed along many-to-one or one-to-one association, never through a collection-valued association. [P 646, Ch 14] But when I am doing that in the code it is generating a CROSS JOIN instead of an INNER JOIN. Mapping is from Member2 (many-to-one) -…
How to unify three different queries in mysql when exists multiple criteria?
I have a table and I need to get the number of rows using different criteria. Currently I use 3 queries one after another: SELECT COUNT(status) FROM projects WHERE project=’1′ SELECT COUNT(status) FROM projects WHERE project=’1′ AND status>’10’ SELECT COUNT(status) FROM …
How to insert multiple rows from a single query using eloquent/fluent
I have the following query: and as expected I get the following result: Is there a way of copying the above result into another table so that my table looks like this? The problem I have is that the $query can expect any number of rows and so im unsure how to iterate through an unknown number of rows. Answer
how to show decimals in sql instead of 0
I am trying to get the percent and it just shows up as zero. I want to show two decimal places such as 0.65 Here is a piece of the query I am selecting: if I use this it shows up as 0 and gets rid of the rest Answer Meanwhile, I question whether COUNT(numbers) is what you want. That
MySQL order by field in Eloquent
When I want to define a custom sort order in a MySQL query I can do something like this: ORDER BY FIELD(language,’USD’,’EUR’,’JPN’) What would be the Eloquent ORM version of that? UPDATE: This is …
Columns with keywords as names in PostgreSQL
I have a couple of tables which have keywords as column names. I am not able to write a subquery using them. Even if I use non-existing column names, the query works. For example I have a few questions – when I use a non-existing column name in a subquery, it works. But if I use the same column name
Redshift – How to remove NOT NULL constraint?
Since Redshift does not support ALTER COLUMN, I would like to know if it’s possible to remove the NOT NULL constraints from columns in Redshift. Answer You cannot alter the table. There is an alternative approach. You can create a new column with NULL constraint. Copy the values from your old column to …